Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing a MovieClip on stage through XML

Status
Not open for further replies.

maguskrool

Technical User
Dec 11, 2006
77
PT
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.

Code:
//xml
<my_data>
  <movie_clip1>mBuilding</movie_clip1>
  <movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."

I've been trying different things, but I'm still stumped. Can anyone give me some advice?

Thanks in advance.

 
Code:
var arr:Array = xmlMovies.movie_clip2.split(".");
var disp:DisplayObject = this;
for(var i:uint = 0, len:uint = arr.length; i < len; i++){
   disp = disp[arr[i]];
}

trace (disp.name);
Output:
mFloor

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top