Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
Non-empty strings in boolean context - Flash7

Non-empty strings in boolean context - Flash7

2004-03-20       - By Morten Barklund

 Back
Reply:     1     2     3     4     5     6     7     8     9     10  

Hi,

When researching, I've read that in Flash MX 2004, strings converted to
booleans are true, when non-empty whereas they in Flash MX were true, only
when Number(string) where non-nil and non NaN.

That is:

trace("hi" ? true : false);

Traced false in Flash MX but true in Flash MX 2004.

I understand that.

But then I assumed, that this would be the case in any boolean context,
where I'd assume, that the flash interpreter uses boolean conversion.

For instance, in Flash MX:

trace("hi" || "goodbye");

Traced "goodbye", as Boolean("hi") resolves to false. That is directly after
the book.

Can someone please tell me, why Flash MX 2004 trace "goodbye" as well - and
not "hi", which I'd assume would resolve to true?

I'm pretty lost here - please tell me that I and not Macromedia made a
mistake on this one.

// Morten Barklund


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107541
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)