I'm trying to set up a loop for a movieclip btn with the instance name ''btnEnter''. btnEnter is loading XML content from a file called menuDef.xml
Here is the code I have inplace so far,
//CODE//
var link: URLRequest = new URLRequest(''menuDef.xml'');
var loader:URLLoader = new URLLoader(link);
var i:int
var myXML:XML = new XML();
//call the loaders load function to load the specified URL
loader.load(link);
loader.addEventListener(Event.COMPLETE,dataLoaded);
//Button code
function dataLoaded (event: Event){
?myXML = new XML(loader.data);
?for (i = 0; i %26lt; 6; i++){
?var j:int = i+ 1;
?/**0 is the line in the?
?xml the labels start from. (i) starts counting from the 0 line until the end
?specified above.**/
?
?this[''btnEnter''].btText.text = myXML.child(0).child(0);
?}
?
?
var item_spacing = 28;
var item_count = 0;
//END OF CODE//
Right now I have only the?item_spacing?and item_count variables in place, but I'm not sure of my next step?
Any help would be great
Cheers-
Graeme
setting loop variable for XMl btnsyou're not sure of the next step to accomplish what?
setting loop variable for XMl btnsI'm trying to get the movieclip I created with xml content loading into it
to loop for each subsequent node I have defined within my xml file.
you didn't create a movieclip.?you only assigned text to a textfield that's in a movieclip.
if you wanted to assign text to btnEnter1, btnEnter2, etc that could be added to your code and i can help you.?but if you want to do otherwise, you haven't explained enough to help you.
Okay so I have a button in Flash called btnEnter.
I have assigned text to a text box with the btnEnter.
I want to a loop var to create another?btn just below the first one and have
the subsequent childnode data fill into the respective pages
I have attached a picture to clarify
Hope this helps
assign btnEnter a class, say BtnEnter.?you can then use:
//CODE//
var link: URLRequest = new URLRequest(''menuDef.xml'');
var loader:URLLoader = new URLLoader(link);
var i:int
var myXML:XML = new XML();
//call the loaders load function to load the specified URL
loader.load(link);
loader.addEventListener(Event.COMPLETE,dataLoaded);
//Button code
var item_spacing = 28;
function dataLoaded (event: Event){
?myXML = new XML(loader.data);
?for (i = 0; i %26lt; 6; i++){
?var j:int = i+ 1;
?/**0 is the line in the?
?xml the labels start from. (i) starts counting from the 0 line until the end
?specified above.**/
var be:BtnEnter=new BtnEnter();
be.btText.text = myXML.child(0).child(i);?
be.ivar=i; // you'll probably need this later
be.y= item_spacing*i;
?}
?
var item_count = 0;
//END OF CODE//
Right now I have only the?item_spacing?and item_count variables in place, but I'm not sure of my next step?
Any help would be great
Cheers-
Graeme
No comments:
Post a Comment