Has someone found solution to change icons at run-time?

--- In [email protected], "Lance Linder" <[EMAIL PROTECTED]> wrote:
>
> I will have to give this a try again. The first time I tried 
something
> like this I received cast errors saying that I couldn't cast type 
Bitmap
> to type Class. I haven't seen anything in the docs about this but I 
will
> dig some more in hopes there is something in there.
> 
>  
> 
> Thanks,
> 
> Lance
> 
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of JesterXL
> Sent: Monday, July 17, 2006 10:27 PM
> To: [email protected]
> Subject: Re: [flexcoders] Re: Change graphical skin of a button 
control
> at runtime?
> 
>  
> 
> There should be an example in the docs.
> 
> - use Loader; load in the bitmap
> 
> - cast the loader.content to Class
> 
> - pass that in as:
> 
>  
> 
> my_btn.setStyle("upSkin", loadedContent);
> 
>  
> 
> ----- Original Message ----- 
> 
> From: Lance Linder <mailto:[EMAIL PROTECTED]>  
> 
> To: [email protected] 
> 
> Sent: Monday, July 17, 2006 7:07 PM
> 
> Subject: RE: [flexcoders] Re: Change graphical skin of a button 
control
> at runtime?
> 
>  
> 
> Nice example. Only thing is that you have to embed all resources 
even if
> they aren't used. Also adding resources would required a recompile.
> 
>  
> 
> So far I have gotten to the point that I can load in a CSS file at 
run
> time and change styles but I haven't figured out a way to load in 
even a
> JPG at runtime and use as a new skin without embedding it in the
> application.
> 
>  
> 
> Lance
> 
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Tim Hoff
> Sent: Monday, July 17, 2006 5:19 PM
> To: [email protected]
> Subject: [flexcoders] Re: Change graphical skin of a button control 
at
> runtime?
> 
>  
> 
> Hi Guys,
> 
> You can change styles at run-time by changing the styleName 
property, or
> by using setStyle().  Styles can be mxml tags or declared in CSS.
> 
> <mx:Style>    
>     .myCustomButton1 {
>         overIcon:Embed("overIconImage1.gif");
>         upIcon:Embed(source="upIconImage1.gif");
>         downIcon:Embed(source="downIconImage1.gif");
>     }
> </mx:Style>
> <mx:Style>    
>     .myCustomButton2 {
>         overIcon:Embed("overIconImage2.gif");
>         upIcon:Embed(source="upIconImage2.gif");
>         downIcon:Embed(source="downIconImage2.gif");
>     }
> </mx:Style>
> <mx:Button id="myButton" label="Icon Button"
> styleName="myCustomButton1"/>
> 
> Change in AS at run-time:
> 
> myButton.styleName = "myCustomButton2";
> 
> -TH
> 
> 
> --- In [email protected], "Lance Linder" <llinder@> wrote:
> >
> > I have been looking into this exact same thing for the last 
couple of
> > days and I haven't found a way to do it yet either. Seems like 
this
> > isn't possible but maybe there is some obscure way of doing it 
that I
> > haven't tried yet?
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected] 
[mailto:[EMAIL PROTECTED]
> On
> > Behalf Of user_abcxyz
> > Sent: Monday, July 17, 2006 3:34 PM
> > To: [email protected]
> > Subject: [flexcoders] Change graphical skin of a button control at
> > runtime?
> > 
> > 
> > 
> > Is it possible? I want to allow the user at runtime can change 
the 
> > existent graphical skin of a button, however I am not sure if 
it's 
> > possible in Flex. Please help and give me some snippet code to 
> > demonstrate.
> > 
> > Thank you.
> >
>


Reply via email to