[Laszlo-dev] Flash built-in objects

André Bargull andre.bargull at udo.edu
Tue Sep 16 09:12:04 PDT 2008


And they don't stop to do things, people will trip over:

 From 
"http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/String.html":

> When setting a string variable to undefined, Adobe® Flash® Player coerces undefined to null. So, the statement:
> 
>  var s:String = undefined;
> 
> sets the value to null instead of undefined. Use the String() function if you need to use undefined. 



On 9/16/2008 6:02 PM, Henry Minsky wrote:
> We just tripped over 
> 
> ('foo' is String) == false in swf8 but true in swf9
> 
> On Tue, Sep 16, 2008 at 11:32 AM, André Bargull <andre.bargull at udo.edu 
> <mailto:andre.bargull at udo.edu>> wrote:
> 
>     I've tripped over that 'feature' while updating the music example
>     application to show some ID3 infos.
>     First I've tested "if (id3 != null)", that worked perfectly under
>     swf9, but it was ´false´ under swf8. Let's say, I was a bit stumped
>     at that time. Then I tested all these variations to find out what is
>     so magic about the id3-object in swf8. At least "if (!! id3)" works
>     in both runtimes. :-)
> 
> 
>     On 9/16/2008 4:54 PM, P T Withington wrote:
> 
>         Flash is not very good about their built-in objects behaving as
>         objects.
> 
>         Adam used to use something like this to test for an object being
>         a function:
> 
>          if (x == null && (! x)) ...
> 
>         So, functions are similar to null and false in a boolean
>         context, so this might be part of that old hack?
> 
>         On 2008-09-16, at 10:38EDT, André Bargull wrote:
> 
>             Some Flash8 built-in objects are too scary:
> 
>             var id3 = audioplayer.getID3(); //audioplayer is a LzView
>             typeof id3; // 'object'
>             typeof id3.constructor; // 'undefined' -> aha, a built-in object
>             id3 == null; // true
>             id3 == undefined; // true
>             id3 != null; // false
>             id3 != undefined; // false
>             id3 === null; // false
>             id3 === undefined; // false
>             id3 !== null; // true
>             id3 !== undefined; // true
>             Finally:  !!(audioplayer.getID3()); // true
> 
>             Whatever their indention was....!?
> 
> 
> 
> 
> 
> 
> 
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com <mailto:hminsky at laszlosystems.com>
> 
> 



More information about the Laszlo-dev mailing list