Almost all icons in the framework are expected to be embedded, because
the code to load the icons externally is big and slow.  As such, you
have to use [Embed] metadata.

 

[Embed("myIcon.gif")]

var myIcon:Class;

 

[Embed("myOtherIcon.gif")]

var myOtherIcon:Class;

 

var xml:XML = <item icon="myIcon">


myTitleWindow.setStyle("titleIcon", [EMAIL PROTECTED]);



 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of pitziilu
Sent: Friday, December 15, 2006 5:28 AM
To: [email protected]
Subject: [flexcomponents] Re: Embedding an icon...

 

I am trying to do the same thing.

I have this xml for example:
<item icon="myIcon.gif"/>

for every <item> I will add a TitleWindow to the Application, and I
need to set the titleIcon property. I tried it this way:

var iconSource:String = 'url("' + [EMAIL PROTECTED] + '")';
myTitleWindow.setStyle("titleIcon", iconSource);

even if I try to set it manually :
myTitleWindow.setStyle("titleIcon", 'url("myIcon.gif")' );
it doesn't work..

What's the problem? and more important how can I solve it? (is it
because myIcon.gif is not loaded when I set the style?

thank you

--- In [email protected]
<mailto:flexcomponents%40yahoogroups.com> , "genius_gen2k"
<[EMAIL PROTECTED]> wrote:
>
> Hello people,
> 
> I am coding in an .as file and during the runtime I am adding a Canvas
> on the stage. In this way I am adding many canvas depending on the
> data from the XML file. Each Canvas created on the runtime needs to
> have a icon on it i.e. an image icon. All these canvas created on
> runtime needs to be arranged with respect to the height / width of the
> previous created canvas element. In this scenario, i wanted to know
> as to how do I add icon to a canvas, the data/path for which comes
> from an external XML file.
> 
> Amol.
> 
> 55--- In [email protected]
<mailto:flexcomponents%40yahoogroups.com> , "genius_gen2k"
> <genius_gen2k@> wrote:
> >
> > How do we dynamically use an image as icon for Canvas component,
> > writing the code in the .as file. 
> > 
> > Amol.
> >
>

 

Reply via email to