Hi,
If your downcast does not work - the "as" bit - your variable will
be null -it does not throw exceptions.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#as
Glen
On 01/12/2010 23:07, Micky Hulse wrote:
Hi Glen! Many thanks for the quick reply and example code. I really
appreciate it! :)
On Wed, Dec 1, 2010 at 2:56 PM, Glen Pike<[email protected]> wrote:
How about up-casting:
var mc:MovieClip = loadedDisplayObject as MovieClip;
if(mc) {
mc.play();
} else {
//could be a bitmap, but if it's not guaranteed, then you might need to
do more tests.
var bmp:Bitmap = loadedDisplayObject as Bitmap;
}
Ahhh, very interesting! That's a great idea! Thanks for tip.
I wonder if I will have to use try/catch to avoid any typecasting errors?
Testing now...
Works perfectly!
var mc:MovieClip = o[i] as MovieClip;
if (mc) { trace("movieclip"); } else { trace("other"); }
Pretty cool! Thaks for tip. :)
Have a great day! Much appreciated.
Cheers,
Micky
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders