Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

How can i target a movie of which i set the name based on a variable?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Venian - 08 Jul 2008 15:11 GMT
Hi.

I have the following code:

function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        total = xmlNode.childNodes.length;
        i = 0;
        xVar = 65;
        yVar = 7;
        while (i<total) {
            _root.nume[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            _root.poza[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
            _root.terenuri[i] =
xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
            _root.link[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
            _root.content_mc.attachMovie("imgHolder", "imgHolder"+i,
this.getNextHighestDepth(), {_x: xVar, _y: yVar});
            xVar += imgHolder[i]._x;
            trace(xVar);
            ++i;
        }
        return;
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
_root.xml_file = "terenuri.xml";
xmlData.load(xml_file);

_root.nume = new Array();
_root.poza = new Array();
_root.terenuri = new Array();
_root.link = new Array();

And i want to target the imgHolder[i]; that i have just created through the
while function. I mean I attach a movieclip from the library to which I give a
name composed from "imgHolder"+i where i is the number of the node from the xml.
After that i want to succesfully target the newly created movieclip and get
it's _x so i can attach the next movieclip next to the previous one. After that
i will have a set of function based on the "imgHolder"+i movieclip.

But i need to know how to succesfully target the movieclip.

Thanks a lot.
kglad - 08 Jul 2008 15:15 GMT
use the attach code option to display code in this forum.  otherwise, your code is altered and difficult to read.

_root.content_mc[ "imgHolder"+i];  // is your movieclip reference
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.