Hello Flashcoders,

I've altered my code from my previous post so any help for this problem will be 
appreciated.

I'm loading swf files using createEmptyMovieClip and loadClip. I figured out 
that I couldn't change the text field because it wasn't loaded yet. I've since 
added a variable to the empty movieClip (this[tempName].labelText) and put in a 
listener on the loader.

My problem now is I can't find the correct code to access that variable and 
change the textfield from within the listener. When the swf is on the stage the 
textfield says 'undefined' as exspected. I need it to say 'One Player' or 'Two 
Player'.

XML, code and output is below. Thanks in advance,

Rich 




XML
====================================================
<selectBtns btnSWF="selectBtn.swf">
        <btn id="1" label="One Player" x="150" y="450" w="200" h="50" />
        <btn id="2" label="Two Player" x="450" y="450" w="200" h="50" />
</selectBtns>


code
====================================================
selectBtnSWF = tempNodes[i].attributes.btnSWF;
trace("selectBtnSWF = "+ selectBtnSWF);
trace("selectBtns: tempNodes[i].childNodes.length = "+ 
tempNodes[i].childNodes.length + newline);
for(k=0;k<tempNodes[i].childNodes.length;k++){

        var mcBtnLoader:MovieClipLoader = new MovieClipLoader();

        var loadListener:Object = new Object();
        loadListener.onLoadInit = function(movieClip){
                trace("Button init | Name = "+ movieClip._name);
                movieClip.btnLabel.text = movieClip.labelText;
        }
        mcBtnLoader.addListener(loadListener);
        
        tempBtnName = "selectBtn_"+k;
        somedepth = _root.getNextHighestDepth();
        _root.createEmptyMovieClip(tempBtnName, somedepth);
        trace("tempNodes[i].childNodes[k].attributes.x = 
"+tempNodes[i].childNodes[k].attributes.x);

        this[tempBtnName]._x = tempNodes[i].childNodes[k].attributes.x;
        this[tempBtnName]._y = tempNodes[i].childNodes[k].attributes.y;
        this[tempBtnName].labelText= 
tempNodes[i].childNodes[k].attributes.label;
        trace("this[tempBtnName].labelText= "+ this[tempBtnName].labelText);
        mcBtnLoader.loadClip("images/"+selectBtnSWF, tempBtnName);

        trace("this[tempBtnName].btnLabel.text = "+ 
this[tempBtnName].btnLabel.text);
}



ouput
=========================================
selectBtnSWF = selectBtn2.swf
selectBtns: tempNodes[i].childNodes.length = 2

this[tempBtnName].btnLabel = One Player
this[tempBtnName].btnLabel.text = undefined


this[tempBtnName].btnLabel = Two Player
this[tempBtnName].btnLabel.text = undefined


Button init | Name = selectBtn_0
Button init | Name = selectBtn_1

This communication is for use by the intended recipient and contains
information that may be Privileged, confidential or copyrighted under
applicable law. If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited. Please notify the sender by
return e-mail and delete this e-mail from your system. Unless explicitly
and conspicuously designated as "E-Contract Intended", this e-mail does
not constitute a contract offer, a contract amendment, or an acceptance
of a contract offer. This e-mail does not constitute a consent to the
use of sender's contact information for direct marketing purposes or for
transfers of data to third parties.

Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

           http://www.DuPont.com/corp/email_disclaimer.html
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to