Re: [Flashcoders] help with a menu in xml : solved

2007-05-23 Thread Gustavo Duenas

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

?xml version=1.0 encoding=ISO-8859-1?

POA

article title = Results of POA
text=The proper application of POA (Perception Oriented Advertising)
produces a change in the entire perception, a strengthening of the
capacity to remember a given brand and a clear and firm repositioning.
The result: A visible growth of your products and/or services within
the market/

article title= How do we apply POA text= Complete knowledge of
your brand
Full analysis
Identify the brand's strengths and weaknesses
Value Added Recognition
Competition follow up (what are they advertising, communication
strategy analysis)
Brand character definition
Acknowledgement and study of target groups to be reached
Clear and effective communication and marketing strategy definition
Development of different steps to follow based on the market and
target market to be captured
Communications concept definition
Final marketing campaign idea
/

article title= Previous Steps to POA text=Accept the fact that
you're not a graphic designer, programmer or have a marketing major
Acknowledge the reality that advertising, design and marketing are
not an option but a need for the expansion of your company
Recognize that the money you will pay to help your brand grow is an
investment and not an expense
Again,  bear in mind that the money you will pay to help your brand
grow is an investment and not an expense
Believe in an experienced professional staff to handle your brand.
Your business is what's at stake
Consider that there are not small businesses; even a 'home office'
may be seen as a great corporation. Perceptions!
Keep in mind that -my customers don't buy my brand but what they
perceive of it-.
If you're willing to follow the seven previous steps, you're ready to
make POA a real part of your brand
/

article 

RE: [Flashcoders] help with a menu in xml

2007-05-22 Thread Jesse Graupmann
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

?xml version=1.0 encoding=ISO-8859-1?

POA

article title = Results of POA
text=The proper application of POA (Perception Oriented Advertising)  
produces a change in the entire perception, a strengthening of the  
capacity to remember a given brand and a clear and firm repositioning.
The result: A visible growth of your products and/or services within  
the market/

article title= How do we apply POA text= Complete knowledge of  
your brand
Full analysis
Identify the brand's strengths and weaknesses
Value Added Recognition
Competition follow up (what are they advertising, communication  
strategy analysis)
Brand character definition
Acknowledgement and study of target groups to be reached
Clear and effective communication and marketing strategy definition
Development of different steps to follow based on the market and  
target market to be captured
Communications concept definition
Final marketing campaign idea
/

article title= Previous Steps to POA text=Accept the fact that  
you're not a graphic designer, programmer or have a marketing major
Acknowledge the reality that advertising, design and marketing are  
not an option but a need for the expansion of your company
Recognize that the money you will pay to help your brand grow is an  
investment and not an expense
Again,  bear in mind that the money you will pay to help your brand  
grow is an investment and not an expense
Believe in an experienced professional staff to handle your brand.  
Your business is what's at stake
Consider that there are not small businesses; even a 'home office'  
may be seen as a great corporation. Perceptions!
Keep in mind that -my customers don't buy my brand but what they  
perceive of it-.
If you're willing to follow the seven previous steps, you're ready to  
make POA a real part of your brand
/

article title= What is POA
text =The market has been evolving in the past few