var a:MovieClip = new MovieClip ();
var b:MovieClip = new MovieClip ();
a.addChild( b );

trace  (  MovieClip( b.parent ).play ) // function Function() {}

trace  ( ( b.parent as MovieClip ).play ) // function Function() {}

trace  (  b.parent.play ) // 1119: Access of possibly undefined property
play through a reference with static type
flash.display:DisplayObjectContainer.



_____________________________

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_____________________________


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fumio Nonaka
Sent: Sunday, January 06, 2008 4:22 AM
To: Flash Coders List
Subject: Re: [Flashcoders] parent property woes in AS3

You should cast to the class.  About casting see the following:

Programming ActionScript 3.0 > ActionScript language and syntax > Data 
types > Type conversions:
http://livedocs.adobe.com/flash/9.0/main/00000048.html
_____
Omar Fouad wrote:
> so if I am inside a movieClip mc i should do:
> 
> mc(parent).play(); ???

> On Jan 6, 2008 5:45 AM, Fumio Nonaka <[EMAIL PROTECTED]> wrote:
>>The parent is a property of DisplayObject class, while the play() method
>>is belongs to MovieClip class which is a sub class of DisplayObject.
>>Therefore the reference of the property should be cast to MovieClip class.
>>
>>MovieClip(parent).play();
-- 
Fumio Nonaka

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to