开发者

Changing an image to embedded data

开发者 https://www.devze.com 2023-01-23 13:23 出处:网络
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).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号