So I am using the Flash IDE.

And I am trying to make a preloader on Frame 1 so that it displays and loads progress before anything else is exported/loaded. So all my assets from the Library are on Frame 2 and all Actionscript Code is Exported in Frame 2.

But my Main Document class calls on other external classes that have Embeded images. Which are then exported in the First frame, which causes my game file to be huge in the First frame. And that essentially shows a white screen for a loong time before the preloader eventually shows up, but 60% loaded.

Is there a way to put the embeded images load later? (as in they would start loading in frame 2)

[Slightly offtopic: I had an idea that I might import the images manually (its a tilesheet and a background image) to the Library. And then copypixel from the tilesheet. But I have never done this so I wouldnt know how to copypixel from something in the library]

  • \$\begingroup\$ How do you embed these images in the external classes? AFAIK the Embed meta-tag is only available with the Flex SDK? \$\endgroup\$
    – bummzack
    Commented Jan 12, 2012 at 18:29
  • \$\begingroup\$ [Embed(source="Sprite sheets/TileSheet.png")] Thats how i embed it in the Main public class. I dont even know what Flex is. This is in Flash CS5. \$\endgroup\$
    – user774858
    Commented Jan 12, 2012 at 18:52
  • \$\begingroup\$ If I do that, Flash CS5 tells me that Flex SDK is required and I have to specify a path to the Flex SDK.. so the flex SDK is clearly involved. But why embed assets like this, when you have the Library in Flash where you can do these things? \$\endgroup\$
    – bummzack
    Commented Jan 12, 2012 at 19:56
  • \$\begingroup\$ Oh I see. I was thaught to do it this way if I wanted to use blitting for my tiles. Blitting from a .png file to my movieclip. Now that I try to import it manually to the Library. Nothing seems to work. I dont understand how to blit from the .png that is now in the Library? \$\endgroup\$
    – user774858
    Commented Jan 12, 2012 at 20:20
  • \$\begingroup\$ @Kid: you convert your .png to a symbol and then check it for export and then you can instantiate it in code \$\endgroup\$ Commented Jan 13, 2012 at 7:27

2 Answers 2


If you have Export classes in frame: 2 in your publish settings and use Export in Frame 2 on your shared assets, then you really don't need the [Embed] meta-directive, as it's a Flex SDK thing. Also having everything in your library is going to be clearer.

So now the question is: How do you simulate the behavior of [Embed] using the flash library? Using the Flex SDK you would embed an image like this:

private var MyAsset:Class;

Creating a new instance of MyAsset would return a BitmapAsset instance, which is a subclass of Bitmap.

Using the Flash IDE, you would simply import the image to your library and then export it for ActionScript, as shown in the following screenshot:

flash linkage dialog

I chose the same identifier ("MyAsset") as in the Flex example above.

Now we're basically set. The only difference is in instantiating the asset in code, as the types are different. As you can see in the screenshot, the Flash IDE automatically filled the Base class in for us, which is of type BitmapData. BitmapData is not a DisplayObject, so you cannot add it directly to your scene. So this won't work:

addChild(new MyAsset);

You would have to wrap it in a Bitmap to make it work:

addChild(new Bitmap(new MyAsset));

But since you're embedding a sprite-sheet which you blit to some other BitmapData object, you probably don't even want that. Therefore something like this will do:

var spriteSheet:BitmapData = new MyAsset;
  • \$\begingroup\$ Brilliant! This cleared up everything, and it worked! I am the user that asked the initial question by the way, unfortunaley I do not have enough reputation to Vote this up, but it would be the PREFERRED answer, as it solved the issue! Hey bummzack, although it works from the library now, there is still a bout 60 kb in the first frame( according to file size report). Could this be because my Main Document class, calls on a method in Another class, that immediately instantiates my Sprite sheet ( new MyAsset )? \$\endgroup\$
    – user774858
    Commented Jan 13, 2012 at 11:54
  • \$\begingroup\$ @user774858 You should make sure that you don't use any of your classes in the preloading frame.. probably the simplest way to do that is to have only the preloader code on frame 1 and then instantiate your main class on frame 2. If the answer helped you, please mark it as the accepted answer :) \$\endgroup\$
    – bummzack
    Commented Jan 13, 2012 at 11:57
  • \$\begingroup\$ ACCEPTED! I cant instantiate my Main in another frame...it needs to be the Document class. Otherwise everything false apart ( i know..bad structure ). But I am soo close. The preloader loads beautifully and MOST the filesize is in frame 2. The only damned problem is that the preloader doesn't show untill 60 kb has been loaded ("imaginary" content in First Frame) If I could just narrow it down to what is causing the filesize to reach 60 kb in the first frame I'll be homefree. When the mMain class is read through at frame 1, does it go through Methods that arent even used until frame 3? \$\endgroup\$
    – user774858
    Commented Jan 13, 2012 at 14:52
  • \$\begingroup\$ Can you control the Main class NOT TO load any external classes untill Loading is done? \$\endgroup\$
    – user774858
    Commented Jan 13, 2012 at 14:58
  • \$\begingroup\$ @user774858 No you can't. But actually all the classes should be moved to frame 2 if you set that in your action script settings. Just don't add any references to other classes in your preloading code. And most importantly: make absolutely sure that there's no [Embed()] tag anywhere left.. \$\endgroup\$
    – bummzack
    Commented Jan 13, 2012 at 15:34

I suggest you to use Flash Develop. It's open source and has a template that matches your needs: AS3 project with preloader

I switched from Flash IDE to Flash Develop about two years ago and I'm very satisfied. I converted almost all of my older projects to Flash Develop and it's very easy and quick to do that. I still have some issues with the debugger but it's nothing deadly.

  • 1
    \$\begingroup\$ Opened the thread to suggest the same thing. Flash IDE might be good for drawing and animating, but the code editor is terrible. If you want, you still can create your assets in flash and then export them as a single .swc file. \$\endgroup\$
    – bassneck
    Commented Jan 13, 2012 at 11:29
  • \$\begingroup\$ Yeah, Ive heard great things about FD so I'll most likely jump straight into it after this game is done. Thanks guys! \$\endgroup\$
    – user774858
    Commented Jan 13, 2012 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .