PDA

View Full Version : how do I update/redraw an image from AS


lakor03
07-27-2009, 11:56 AM
Hi here is a quick problem I'm struggeling with:

how do I update/redraw an image from AS

I have created an image in mxml, changed the source, but I guess I somehow need to redraw it so see the change?

<mx:AddChild relativeTo="{myPlayArea}" position="lastChild">
<mx:Image x="0" y="0" width="242" height="484" id="levelImage" source="{imgCls}"/>
</mx:AddChild>

in AS I do something like:


[Embed(source="../assets/img1.jpg")][Bindable]public var imgCls1:Class;
[Embed(source="../assets/img2.jpg")][Bindable]public var imgCls2:Class;


and then

imgCls1 = imgCls2

thanks in advance

shubs6
07-30-2009, 01:01 PM
I assume that in yr app you must be needing to change the image source on some event, say click. So when that event occurs, do this



levelImage.source = imgcls2;
//or
levelImage.url(imgcls2);