Embedding an image in Flash Starling AS3 app

858 Views Asked by At

I am just learning Starling, trying to put an image on the canvas.

the code I am looking at looks like this:

[Embed(source="wordvillelogo.png")]
public static const Mushroom:Class; 

The image itself in located in the same directory as my .as files and FLA file.

Yet, when I compile the code I get an error

unable to resolve 'wordvillelogo.png' for transcoding

What is the correct format to embed this image?

3

There are 3 best solutions below

0
On BEST ANSWER
0
On

if Piterwilson`s answer is not true, try this:

[Embed(source="./wordvillelogo.png")]
public static const Mushroom:Class; 
0
On

You shouldn't use Embed to manage assets if you are targeting mobile. Embed is really slow and could hurt performance specially on the iPad 1 and some older android devices.

You should create an assets folder, embed it with your app and use starling's AssetManager class to get your assets. That's the fastest way, you already get your image as a texture so you don't have to create bitmapdata objects, passing them to a new texture, etc.