Saturday, February 11, 2012

FlashDevelop and ActionScript 3 - how to embed image - fast tip

When you use the official flash ide, using images is as easy as clicking several buttons. Actually using images with FlashDevelop is even easier but if you haven't done it you will need this info.
First copy the desired image into folder of the project, for example I'll name my folder assets.
Add a variable to your class:
private var myImg:Class;
And place your cursor on the row above it. Right mouse button on the image and select Generate Embed Code:

You will get something like this:

private var myImg:Class;

Add this where you want to use the image:

var bitmap:Bitmap = new myImg();

Easy, isn't it?


  1. nice, but i accustomed to using Visual Studio.
    and CodeDrive provide development on ACtionScript 3, see

  2. I have done this..but in my 3D environment(flashDevelop) i just see a white screen
    when I switch back to just color works:

    [Embed(source = "assets/cube.png")]
    private var cubeBitmap:Class;

    used light this:
    var materialBitmap:BitmapData = new cubeBitmap();
    material = new TextureMaterial(new BitmapTexture(materialBitmap));

    however in flash ...import the image to lib, then export for actionscript
    (no need to embed)
    and the above code works

    I though if I just add the embed...the usage wil be same?

    can anyone help me?