actionscript 3 - Access children of embedded aswf -


i embedding swf file has children on timeline. this:

[embed(source="assets/skyscraper200x600.swf")] private var skyscraper  :class; 

all children in swf have instance name, double checked when creating swf in flash cs5. trying access children name this:

_bg = movieclip(new skyscraper()); _pig = movieclip(_bg.getchildbyname("chara_pig")); _arrow = movieclip(_bg.getchildbyname("arrow_banner")); 

however, both _pig , _arrow end being null.

what's stranger when @ skyscraper object in debugger, shows rather strange class name , loader child (which in turn has no children). what's this?

.

i can access them above if not embed swf, load loader. cannot in case. need embed swf.

so, how can access children of embedded swfs?

i not talking accessing classes in library of embedded swf, instances on timeline.

here solution. can see steps helped me find solution (describetype friend) :

public class demo extends sprite {      [embed(source="test.swf")]     private var test:class      public function demo() {         //first guess embed swf movieclip         var embedswf:movieclip = new test() movieclip;         addchild(embedswf);          //well, emebed swf more movieclip...                trace(describetype(embedswf));//mx.core::moviecliploaderasset         trace(embedswf.numchildren);//1         trace(describetype(embedswf.getchildat(0)));//flash.display::loader          var loader:loader = embedswf.getchildat(0) loader;          //the content not loaded...         trace(loader.content);//null           loader.contentloaderinfo.addeventlistener(event.complete, function(){             var swf:movieclip = loader.content movieclip;             var child:movieclip = swf.getchildbyname("$blob") movieclip;             //do nasty stuff movieclip !         });     } } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -