PDA

View Full Version : Referencing a MovieClip on stage through XML


maguskrool
05-29-2008, 11:33 AM
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.


//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.

box86rowh
05-29-2008, 03:41 PM
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.


//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.
did you fix this?

amarghosh
05-30-2008, 08:21 AM
trace(XML(xmlMovies.movie_clip1));

trace(XML(xmlMovies.movie_clip1).text());

trace(XML(this["xmlMovies"].movie_clip1).text());

trace(XML(this["xmlMovies"]["movie_clip1"]).text());
just writing without testing.. so please tell me which on of these worked / not worked.
:)

senocular
05-30-2008, 02:02 PM
see
http://www.kirupa.com/forum/showthread.php?t=299284

amarghosh
05-30-2008, 02:20 PM
:p
oops!!! i thought maguskrool just wanted the content (just the strings) of the xml.