-
Loading images at random from library
Hi there, I started to use flash again! I created my project of loading in images at random using an external folder. I used this:
var myRand = Math.floor(Math.random(42)*10+1);
PlaceHolder.loadMovie("Slide"+myRand+".jpg");
It works great . . .but then I wanted to put the swf on my site and realised I don't have the folder of images so I tried to sort this and put them into the library, used some attachMovie aclls and couldn't get it to do the same thing.
what am I missing here?
How do I load all of my images into my library and call them to the place holder?
thanks!
-
.
Hi,
You can load it lke so, you must give the images an AS Linkage name which can be found in the library itself
PHP Code:
import flash.display.BitmapData;
var myRand:Number = Math.floor(Math.random(42) * 10 + 1);
trace("Slide" + myRand);
var imageBitData:BitmapData = BitmapData.loadBitmap("Slide" + String(myRand));
PlaceHolder.attachBitmap(imageBitData,this.getNextHighestDepth());
-
.
or you could alternatively use your original code if you create the folder you need put it online and put the images there too
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|