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)
- (In adobe flash pro) File -> Import -> Import to stage. NOTE: This is missing one important step, read on…
- Right click the image -> Convert to symbol
- Name the Image something like “CallToAction”
- Check the “Export for ActionScript” and Export in frame 1 checkboxes
- Save
- File -> Publish Settings -> check the “SWC” checkbox -> Ok
- File -> Publish
In Adobe Flash Builder
- Right click the project or create a new project.
- Under “ActionScript Build Path” -> “Add SWC…”
- 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)
- File -> Import… -> Import to stage -> (select your file)
- (If your image is a png) Right click the image in your library window -> Properties… -> Compression -> (Select “Lossless”) -> Ok
- Right click the image -> Convert to symbol
- Name the image something like “CallToAction”
- Check the “Export for ActionScript” and “Export in frame 1” checkboxes
- Save
- File -> Publish Settings -> check the “SWC” checkbox -> Ok
- 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