Certain Images Not Loading in Flash Builder

Well if you’re anything like me right now, you’re at your wits end, you’ve given up and your browser any site you can find that says something about images/importing and adobe flash builder…

To no avail…

I just spent the last 3 hours (3:07 to be exact) trying to figure out what some images import into flash builder and some don’t. WTF? Turns out, there’s one more step you need to take with pngs and that was my problem. I’m using the following method to pack images into a swc:

In Adobe Flash Pro (Incomplete Procedure)

  1. (In adobe flash pro) File -> Import -> Import to stage. NOTE: This is missing one important step, read on…
  2. Right click the image -> Convert to symbol
  3. Name the Image something like “CallToAction”
  4. Check the “Export for ActionScript” and Export in frame 1 checkboxes
  5. Save
  6. File -> Publish Settings -> check the “SWC” checkbox -> Ok
  7. File -> Publish

In Adobe Flash Builder

  1. Right click the project or create a new project.
  2. Under “ActionScript Build Path” -> “Add SWC…”
  3. File -> Restart

Your code should look like the following assuming you named your symbol “CallToAction” and exported it for actionscript in flash pro:

package
{
	import flash.display.MovieClip;
	import flash.display.Sprite;

	public class webcam extends Sprite
	{
		public function webcam()
		{
			var drawing:MovieClip = new CallToAction() as MovieClip;
			addChild(drawing);
		}
	}
}

Now then…The hard part…

Make sure, I repeat, ahem….make sure if you are working with pngs, that after you have imported your image and before you convert it to a symbol, that you right click the image in the library, go to the properties tab, and then select the “Lossless” option under  “Compression”. So the process looks something like this:

In Adobe Flash Pro (Correct Procedure)

  1. File -> Import… -> Import to stage -> (select your file)
  2. (If your image is a png) Right click the image in your library window -> Properties… -> Compression -> (Select “Lossless”) -> Ok
  3. Right click the image -> Convert to symbol
  4. Name the image something like “CallToAction”
  5. Check the “Export for ActionScript” and “Export in frame 1” checkboxes
  6. Save
  7. File -> Publish Settings -> check the “SWC” checkbox -> Ok
  8. File -> Publish

Good resource here: http://www.htmlgoodies.com/beyond/webmaster/toolbox/article.php/3864136/Flash-Tutorial-How-to-Import-MovieClips-into-a-Flash-Builder-ActionScript-Project.htm and here: http://www.codeandvisual.com/2009/how-to-import-movieclips-into-a-flash-builder-actionscript-project/

Night

Leave a Reply

Your email address will not be published. Required fields are marked *