title: Howto embed images in Actionscript 3 / Flex 3 the right way?
body: <p>I'm creating a game where a lot of images are being used in Actionscript / Flex 3 (Flash). Now that I've reached the designer stage, I have to work out a structural way of using embedded images (which have to be manipulated with rotation, color, etc.).</p>
  
  <p>Unfortunately, after investigating a bit, it looks like you have to manually embed images before you can use them. I currently have it setup like this:</p>
  
  <p>Resource.as class file:</p>
  
  <pre><code>package
  {
      public final class Resource
      {
          [Embed (source="/assets/ships/1.gif" )]
          public static const SHIPS_1:Class;
      }
  }
  </code></pre>
  
  <p>So, just for one ship I so for have to:</p>
  
  <blockquote>
    <p>Put the image in the correct folder with the correct name
    Name it in the same way in the Resource.as file
    Create the constant with the same name in the Resource.as file</p>
  </blockquote>
  
  <p>Even though this should all be possible by simply putting the file in a specified folder.</p>
  
  <p>To make things even worse, I still have to call it using:</p>
  
  <pre><code>var test:Bitmap = new Resource.SHIPS_1();
  </code></pre>
  
  <p>There must be better ways to handle resources when creating very huge applications? Imagine I need thousands of images, this system simply wouldn't fit.</p>