Hi everybody,
I would like to create a slideshow template through actionscript, loading images which are embedded in the same swf as the script.
I've tried creating an array and populating it with the names of the images, but I can't find a way to create movieclips containing those images: I know it can be done by loading files from a separate folder, but I would do this with selfcontained images.

Anyone can help?
Thanks in advance and bye all,
s

Member Avatar for GreenDay2001

By self contained do you mean pictures embedded in flash, as library clips and dynamically load it?? Please be more clear.

Hello Vishesh,
I meant exactly that: pictures embedded in the flash file, as library clips, to be dynamically loaded through actionscript. Sorry for having been inaccurate.

Apparently, I succeded using "BitmapData.loadBitmap()". This is the example I found on Flash Help:

import flash.display.BitmapData;
var linkageId:String = "libraryBitmap";
var myBitmapData:BitmapData = BitmapData.loadBitmap(linkageId);
trace(myBitmapData instanceof BitmapData); // true
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());

What is annoying is that I have to set a Linkage manually, for each bitmap image I have in the library. I've tried selecting multiple files and right-clicking, but the command "linkage..." becomes unclickable. Let's say I have a slideshow with fifty images: I have to right-click and set linkage fifty times!
The new question is: can multiple files' linkage be done in an automated (smart) way? I would just say to Flash that all the bitmaps in the library must have a linkage name equal to the files'names.

bye,
s

Member Avatar for GreenDay2001

>can multiple files' linkage be done in an automated (smart) way?
I think and am pretty sure that isn't possible.

But one thing I want to say is that you shouldn't put 50 images in one swf. If will increase file size, loading time. You should use a XML file to put links and captions of all images and load images dynamically.

Hi Vishesh,

I know (and agree) that my solution would be insane for a website, but I'm preparing swf files to be embedded in a pdf presentation, than I'd prefere not to have external link (neither I'm sure that connection via XML would work).

Thanks anyway for your reply.

p.s.
By the way I found a rough method not to have to reassign linkage every time:
1 - batch rename of the images: 0.jpg, 1.jpg, 2.jpg, ...
2 - replace a group of images with the same name, with pre-assigned linkage, in a template file.

Not that elegant, but it does the job :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.