I’ve trawled the net trying to find a solution, but everything seems to be mxml-centric. What I want is to dynamically create a series of Graphics objects each with a child BitmapImage. However, this doesn’t seem to work:
var bmi:BitmapImage = new BitmapImage();
bmi.source="@Embed('custom-case.png')";
var gr:Graphic = new Graphic( );
gr.addElement( bmi );
gr.x = 50;
gr.y = 50;
this.addElement( gr );
Whereas, this does:
<s:Graphic x="250" y="250">
<s:BitmapImage source="@Embed('custom-case.png')">
</s:BitmapImage>
</s:Graphic>
Thanks in advance for any ideas.
Paul
it is quite different in AS3, you have to define a variable class type like shown below.