actionscript 3 - Calling children inside getChildByName / getChild At? -


I found out that if I use getChildAt / getChildByName, I can not target an object inside the main object. It will return me

  Error # 1119: Some use of possibly undefined property through a reference with static type flash. Presentation: DisplayObject  

I was trying to do something like

  this.getChildAt (0) .getChildByName ("objectName") ....  

getChildByName and other type of child type object type DisplayObject . It should be appropriately inserted before you are not related to the properties or display items. Also keep in mind that these are related to the DisplayObjectContainer class of children - so that you try to do the You can not do that kind of chain.

  var Container: DisplayObjectContainer = DisplayObjectContainer (getChildAt (3)); Var Mac: MovieClip = Movie Clip (Container.Getbuildbinnam ("Intro_movie")); Mc.gotoAndStop (4); // or var container: DisplayObjectContainer = GetChildAt (3) as DisplayObjectContainer; Var Mac: MovieClip = Container.GetBillBinam ("Intro_movie") as a movie clip; Mc.gotoAndStop (4); // or movie clip (display object container (getChildAt (3)). GetChildByName ("intro_movie")). GotoAndStop (4);   

Casting with ClassName (OBJ) Syntax will fail if cast fails; Casting with classname in the form of obz - returns empty returns without error - it can cause confusion later because it can cause error 1009 (empty reference) to unexpected places.


Comments