hi guys

it's been a while since i last posted but i really hope you guys can help

i'm using the flash 6 player and actionscript 1.0

i am trying to pass a value from a loadVars object to a variable elsewhere in the movie but it doesn't seem to want to go

the whole menu is set up using an xml file which loads as expected

the object is set up like this

function loadMenu(XMLDoc) {

        var textFilesPath = "./updateable_files/";
// --> sets a reference to the whole path to grab the text files for the load() method (at the bottom)

        XMLVars = new XML();
        XMLVars.onLoad = function(success) {
                if (success) {

                        for (i=0;i<this.firstChild.childNodes.length;i++) {

                                var thisKind = 
this.firstChild.childNodes[i].attributes.kind;
                                trace(thisKind);
// --> sets up a reference to the menu item from the attribute of the xml node named 'kind') // --> trace returns correct name and is used elsewhere for loading images into another movie correctly using a loadMovie

                                // --> function for setting common attributes 
on all menu items
                                setMenuCommonAttributes = function() {

                                        // --> sets up object to pass to this 
menu item
                                        var tempObject = new Object();
                                        tempObject.description_txt = "some 
copy";
                                        tempObject._y = 13 * i;
                                        _root.menu.attachMovie("menuItem_clip", 
thisKind, i, tempObject);

                                        trace (typeof 
_root.menu[thisKind].description_txt);
                                        // --> trace returns "string"

                                        trace 
("_root.menu[thisKind].description_txt);
                                        // --> trace returns "some copy"
                                };

                                var thisText = new LoadVars();
                                thisText.onLoad = function(success) {
                                        trace ("thisText TXT fired");
                                        if (success) {
                                                var thisInstanceText = this.txt;

                                                trace (thisInstanceText);
                                                // --> trace returns copy as 
expected

                                                
_root.menu[thisKind].description_txt = thisInstanceText;
// -->       this seems to be where things go wrong

                                                trace (typeof 
_root.menu[thisKind].description_txt);
// -->       returns "undefined"

                                                trace 
(_root.menu[thisKind].description_txt);
// -->       returns "undefined"

                                        } else {
                                                // --> error handler
                                                trace ("text content failed");
                                                thisText.txt = "error loading text 
file";
                                        }
                                };
                                var textDoc = _root.menu[thisKind].description;
                                thisText.load(textDoc);

                } else {
                        _root.description.htmlText = "<b>Error loading 
content</b>";
                }
        }
        XMLVars.load (textFilesPath+XMLDoc);
}

the problem areas have had the indentation taken out

i really hope you guys can help - i can't imagine it's a scope problem because i'm using an absolute path to the variable i want to change (_root.menu[thisKind].description_txt which works at the setup stage but seems to be undefined when i try to pass something else to it) and it can't be a problem with the loadVars object because i've passed a copy of the variable to a local variable (thisInstanceText) first and that traces fine

i know it's something stupid

alz
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to