Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.display.Bitmap;
- //creates a loader for each picture to be loaded, I know I could have an empty array that I add to but created a full array to test.
- var loaders:Array = [new Loader(),new Loader(), new Loader(), new Loader(), new Loader(), new Loader(), new Loader(), new Loader(), new Loader(), new Loader()];
- //stores the url request for each image to be loaded
- var Requests:Array =[new URLRequest("pic1.jpg"),new URLRequest("pic2.jpg"),new URLRequest("pic3.jpg"),
- new URLRequest("pic4.jpg"),new URLRequest("pic5.jpg"),new URLRequest("pic6.jpg"), new URLRequest("pic7.jpg"),
- new URLRequest("pic8.jpg"), new URLRequest("pic9.jpg"),new URLRequest("pic10.jpg")];
- //creates 2 empty arrays one to store the thumbnail sized pics the other fullsized. Ideally I want one Array holding the bitmap data and the other holding the thumbnail instances since I only need 2
- // fullsized images at a time I can just create a new one and erase the old one in a single function.
- var pics:Array = new Array();
- var pics2:Array = new Array();
- //defines an empty bitMap variable as a placeholder for which to copy from redefined in every iteration of the loop
- var test:Bitmap;
- //loops through every loader
- for (var i in loaders);
- {
- // loads the loader and url request and creates a picture
- loaders[i].load(Requests[i]);
- //waits for the pic to load
- loaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
- //after loader is loaded create pic from the data
- function loadComplete(evt:Event):void
- {
- var i = "Test";
- trace(i);
- test= evt.target.content as Bitmap;
- pics2[i] = test;
- pics[i] =new Bitmap(test.bitmapData);
- pics2[i] =new Bitmap(test.bitmapData);
- //creates an image on the stage at runtime to help debug
- var pic1 = new Bitmap(test.bitmapData);
- addChild(pics[i])
- pic1.scaleX = 0.138427734375;
- pic1.scaleY = 0.1384114583333333;
- pic1.x = 204;
- pic1.y = 20.6;
- pic1.alpha = .25;
- var pic2:Bitmap = new Bitmap(test.bitmapData);
- pic2.x =100;
- pic2.y =100;
- pic2.scaleX =.33;
- pic2.scaleY=.33;
- addChild(pic2);
- loaders[i].contentLoaderInfo.removeEventListener(Event.COMPLETE, loadComplete)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement