Radley,

Thanks for the response but I can't do that because at that point the movieclip 
hasn't been initiated yet. 

I'm using a listener to tell when the movieClip is initiated. 'labelText' is 
just a variable attached to the movieClip so I can grab it later. 

I'm looking for the code that lets me grab 'labelText' from within a listener 
object. Here's what I have

loadListener.onLoadInit = function(movieClip){
        trace("Button init | Name = "+ movieClip._name);        // which 
returns the corect value - 'selectBtn_0' or 'selectBtn_1'
        trace("moveClip.labelText = "+ movieClip.labelText);    // which 
returns 'undefinded' - I want it to return 'One Player' or 'Two Player'        
        movieClip.btnLabel.text = movieClip.labelText;          // puts 
'undefined' correctly in the textfield - but I don't want 'undefined', see above
}

I know that 'labelText' is attached to the movieClip because outside the 
listener I have this trace:

>       trace("this[tempBtnName].labelText= "+ this[tempBtnName].labelText); 
> returns 'One Player' or 'Two Player' as exspected

Thanks again,

Rich


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Radley
Marx
Sent: Thursday, December 01, 2005 6:37 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Changing a textfield on a dynamically
addedmovieClip






Add .text at the end of your text field & change the coding for  
accessing attributes...


new: this[tempBtnName].labelText.text = tempNodes[i].childNodes 
[k].attributes["label"];


original: this[tempBtnName].labelText= tempNodes[i].childNodes 
[k].attributes.label;


-radley




On Dec 1, 2005, at 1:21 PM, Azinger, Richard wrote:

>
> 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].labelText = One Player
> this[tempBtnName].btnLabel.text = undefined
>
>
> this[tempBtnName].labelText = 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