[AS3] Noob Question about Importing.

Subscribe to [AS3] Noob Question about Importing. 12 posts

avatar for Mysterymason Mysterymason 5436 posts
Flag Post

How can I import (say a pixel art drawing) into AS3 so I can use it as a movable object?

 
avatar for RTL_Shadow RTL_Shadow 1020 posts
Flag Post
Originally posted by Mysterymason:

How can I import (say a pixel art drawing) into AS3 so I can use it as a movable object?

What IDE are you using?

 
avatar for Mysterymason Mysterymason 5436 posts
Flag Post

Please explain. Sorry, a real noob here. Something Something Environment, yes?

 
avatar for BigJM BigJM 468 posts
Flag Post

Flash CS, Flash Builder, Flash Develop, etc?

 
avatar for Mysterymason Mysterymason 5436 posts
Flag Post

Adobe Flash CS6.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post

Drag the file into flash.

It’s that easy.

 
avatar for feartehstickman feartehstickman 521 posts
Flag Post

Or File>Import>To Library if you want.

Then, drag it from the library onto the stage if you want, or add it through code.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by feartehstickman:

Or File>Import>To Library if you want.

Then, drag it from the library onto the stage

Or le gasp File>Import>To Stage :O

 
avatar for draganviper draganviper 1043 posts
Flag Post

..or copy and paste.

 
avatar for alecz127 alecz127 817 posts
Flag Post

Alternatively, If you want to say… Get this realistic to history portrait of George Washington to display on screen.

You could do it entirely programmically.
Just put the “image.jpg” in the same folder or location as the code file that executes the below. Feel free to download the picture for this example and try it yourself.

//Embeds a new image, and gives it a class
[Embed(source="image.jpg")]
var ImageD:Class;

//creates a new BitmapData variable that points to our new classes bitmapData
var imageD:BitmapData = new ImageD().bitmapData;

//creates a new bitmap variable that uses our new bitmapData variable
var image:Bitmap = new Bitmap(imageD);

//we can now add "image" to our stage, move it around with x and y, all that fun stuff.
stage.addChild(image);
 
avatar for Ace_Blue Ace_Blue 1070 posts
Flag Post

Point of nitpick: Since it’s the bitmap you want in the end, not the bitmapData, you can contract

//creates a new BitmapData variable that points to our new classes bitmapData
var imageD:BitmapData = new ImageD().bitmapData;

//creates a new bitmap variable that uses our new bitmapData variable
var image:Bitmap = new Bitmap(imageD);

into

var image:Bitmap = new ImageD;
 
avatar for feartehstickman feartehstickman 521 posts
Flag Post
Originally posted by Draco18s:
Originally posted by feartehstickman:

Or File>Import>To Library if you want.

Then, drag it from the library onto the stage

Or le gasp File>Import>To Stage :O

Well played sir.