Changing an image to embedded data
I know how to embed an image, but I want to change an image to any of the embedded images on request (a function call).
[Bindable]
pub开发者_StackOverflow中文版lic var icoEstado:Class;
[Embed(source="src/assets/etapa.n.png")]
[Bindable]
private var estadoN:Class;
[Embed(source="src/assets/etapa.ok.png")]
[Bindable]
private var estadoOk:Class;
[Embed(source="src/assets/etapa.x.png")]
[Bindable]
private var estadoX:Class;
public function estado(i:String):void
{
switch(i)
{
default:
case 'x':
icoEstado = estadoX;
return;
case 'n':
icoEstado = estadoN;
return;
case 'k':
icoEstado = estadoOk;
return;
}
}
and then...
<s:BitmapImage id="ico" source="{icoEstado}"/>
This isn't working... any advice?
Thanks!
The only solution I've found is to use the mx:Image
component instead.
精彩评论