Hi,

Try defining newsIcon variable in application scope instead of inside a
loop....That's is something I doubt...

Compiler embeds the asset in the swf and assigns the symbol name(linkageID)
to the variable. Since this variable is a local variable, it might not be
working...


Like:


                [Embed(source="news2.jpg")]
                var newsIcon:String;

                var buttonArray = new Array(ar_documents.length);
                for(var i=0;i<buttonArray.length;i++){
                        buttonArray[i] = Button(owner.createClassObject(
Button, "button"+i, 2+i, owner));
                        buttonArray[i].label = ar_documents[i].title;
                        buttonArray[i].styleName = ("readmore");
                        
                        Button(buttonArray[i]).icon = newsIcon;
                        Tracer.trace("buttonArray[i].icon: " + newsIcon);
                        
                        buttonArray[i].labelPlacement = "left";
                        buttonArray[i]._x = 0 + i*85; 
                        buttonArray[i]._y = 65; 
                }







-abdul 

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 27, 2005 8:39 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Setting icons in Buttons



I'm creating an array with Buttons, then a set the label and icon.
When i display them, I only see the label and not the icon!! 

I tried:
        

var buttonArray = new Array(ar_documents.length);
                for(var i=0;i<buttonArray.length;i++){
                        buttonArray[i] = Button(owner.createClassObject(
Button,
"button"+i, 2+i, owner));
                        buttonArray[i].label = ar_documents[i].title;
                        buttonArray[i].styleName = ("readmore");
                        
                        [Embed(source="news2.jpg")]
                        var newsIcon:String;
                        
                        Button(buttonArray[i]).icon = newsIcon;
                        Tracer.trace("buttonArray[i].icon: " + newsIcon);
                        
                        buttonArray[i].labelPlacement = "left";
                        buttonArray[i]._x = 0 + i*85; 
                        buttonArray[i]._y = 65; 
                }

but also:

Button(buttonArray[i]).icon = "@Embed('news2.jpg')";





 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to