Thanks man, it works...
Regards
Gustavo Duenas
On May 22, 2007, at 5:32 PM, Jesse Graupmann wrote:
Your problem might be that your buttons are sharing the same scope
when
attempting to access individual variables. When you do something like:
_root.screenTxt.myText_txt1.text=menuTitle+":"+textMenu; each
button points
to the last variable you created in the loop.
By attaching the data to the button, you can access individual
information
using 'this' inside the function.
I haven't tested this, but it looks better to me...
menus = new XML();
menus.ignoreWhite = true;
menus.onLoad = function(success)
{
var target = _root.screenTxt.myText_txt1;
var holder = _root.menu;
var titleMenus = this.firstChild.childNodes.length;
var menuContent = this.firstChild;
for (var i = 0; i < titleMenus; ++i )
{
var depth = holder.getNextHighestDepth();
var btn = holder.attachMovie( "buttons", 'btn_' + i , depth
);
btn._x = 0;
btn._y = -10 * i * 4;
btn.data = {
text: menuContent.childNodes[i].attributes.text,
title: menuContent.childNodes[i].attributes.title
};
btn.poa.text = btn.data.text;
btn.onRelease = function(){
target.text = this.data.title + ":" +
this.data.text;
}
}
}
menus.load("txt/poa.xml");
_
Jesse Graupmann
www.jessegraupmann.com
www.justgooddesign.com/blog/
_
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Gustavo
Duenas
Sent: Tuesday, May 22, 2007 1:20 PM
To: Flashcoders mailing list
Subject: [Flashcoders] help with a menu in xml
Hi coders, this is thread is the second part of the other.
well I have the buttons created and I have this onRelease behavior
attached to a every single button,
but when I tried to read into a text field part of the xml(text) this
one only reads one, not the others and when I traced them , they are
there(in the output window) but not into the field as they are
supposed to.
This is my code in as2 again:
stop();
menus = new XML();
menus.ignoreWhite = true;
menus.onLoad = function(success) {
//portfolioTag = this.firstChild;
titleMenus = this.firstChild.childNodes.length;
menuContent = this.firstChild;
for (var i = 0; i < 4; i++){
// either "menu" or "item"
menuContent.childNodes[i].nodeName;
// name of the item
menuTitle= menuContent.childNodes[i].attributes.title;
var buttonsMenu= _root.menu.attachMovie("buttons", menuTitle, 10+i);
buttonsMenu._x=0;
buttonsMenu._y=-10*i*4;
var newText = buttonsMenu.poa.text=menuTitle;
// action of the item
textMenu= menuContent.childNodes[i].attributes.text;
trace(textMenu);
buttonsMenu.onRelease = function(){
_root.screenTxt.myText_txt1.text=menuTitle+":"+textMenu; // loads
good but only one, the rest appears not to be there:(
};
}
}
menus.load("txt/poa.xml");
and this is xml
Gustavo Duenas
Creative Director
LEFT AND RIGHT SOLUTIONS LLC
1225 W. Beaver St. Suite 119
Jacksonville, Fl. 32204
904 . 2650330
www.leftandrightsolutions.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com