A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading images at random from library

  1. #1
    Junior Member
    Join Date
    Mar 2018

    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);


    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?


  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011

    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;

    myRand:Number Math.floor(Math.random(42) * 10 1);
    trace("Slide" myRand);

    imageBitData:BitmapData BitmapData.loadBitmap("Slide" String(myRand));


  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    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

Click Here to Expand Forum to Full Width

HTML5 Development Center