Import graphics for scripting

Hi,

When working on games etc. I want to import say, 30+ gfx parts for my project.

These are named pngs carrot.png, carrot_eaten.png etc.

Now I just want to access these source gfx from my actionscript code. And here is my question,

Do I really need to manually convert each source image to a “graphic” by dragging it to the stage, hit F8, and check the export for script box!?

I’ve seen many are using the timeline and jumping to frame positions for swapping graphics. When I’m used to director and want to keep my code as selfcontained as possible, using flash specific timeline isn’t an option…

change all your png’s to jpgs, and call them from your code, much like director. Unlike Director, though, you may want to load them into movie clips, for added flexibility.

forgot to mention… if you’re trying to keep it all in vector format, then the way you described is the only way I know. Just consider them actors the way director does.

Don’t really get it. What would be the difference from using gif,png or jpg.

I guess you’re talking about the loadMovie command!? But then I need to place all the graphics external. You can’t get any speed that way? or can you?

Say for a game it’s nice to have all the material within the actual flash file

thanks

if you want to dynamically attach each image, then yes, you would have to convert each into a movieclip and give each a linker ID to reference from AS.

Alternatively, you could add them to a movieclip frame by frame, then just name and attach that movieclip telling it to go to whatever frame it needs to be in to access the right bitmap. You can make this easier by having their filenames a numbered sequence ie.

img01.png
img02.png
img03.png
…etc.

So that, when imported into flash when within that movieclip (just import 01) then Flash will see them as an image sequence and import them one by one for each frame within that movieclip. Then that movieclip, as mentioned before, can be told to go to whatever frame it needs to to display the correct movieclip.

Yes I know, you dont like this. Yes, I know, its easier to manage in Director. Flash, however, is made to be small. swf even stands for Small Web File. Because of this, their really wasnt much of a need for an easy systematic method of handling a lot of bitmaps. The strength lies in those tiny vector images, which, theoretically, would be for the most part built and managed from within flash directly.

Thanks! Just to grab a cup of coffe and right-click-name-check a couple of times and you’re done…

weird though that the loadMovie does this prefectly to an external jpg. Would be cool if loadMovie could use internal library names aswell!

did the prudent thing (i guess) and searched b4 I started a new thread. hopefully i can piggy back this one.

I suspect Flash does not allow the dynamic importing of .png files (that is using “loadMovie()” method). Am I wrong???

Works fine for jpgs… but not pngs.

Yea, you can’t dynamically load png files within flash.