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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of JesterXL
Sent: Monday, July 17, 2006 10:27 PM
To: flexcoders@yahoogroups.com
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

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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tim Hoff
Sent: Monday, July 17, 2006 5:19 PM
To: flexcoders@yahoogroups.com
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 flexcoders@yahoogroups.com, "Lance Linder" <[EMAIL PROTECTED]> 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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
> Behalf Of user_abcxyz
> Sent: Monday, July 17, 2006 3:34 PM
> To: flexcoders@yahoogroups.com
> 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.
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to