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 title= "What is POA"
text ="The market has been evolving in the past few years, therefore
the communication tools cannot be the same. Along with the market,
the consumer has also changed.
Thanks to our innovated communication method called POA (perception
Oriented Advertising) we can reach your potential customers in a
clear, direct and different way. This communication method is based
on an important research conducted in the United States where it was
concluded that customers don't buy products or services; they buy
perceptions. For example, women don't buy make-up, they buy beauty.
Men don't buy gym services, they buy a perfect body. Executives don't
buy luxury vehicles, they buy status. Observe the difference between
what I buy- and -how I feel when I buy it-.
This is what our effective communication tool is all about: reality
vs. perception. The way in which you communicate your products or
services is the perception your potential customers will have of you.
So please be particularly careful with the way you advertise your
products or services."
/>
</POA>


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

Reply via email to