Hi guys... I'm kind of desperate, I have my code working beautifully for loading in an image at full screen...
BUT now I want to be able to have random images loading... I had this previously but can't seem to implement it into the new code...Code:Stage.scaleMode = "noScale"; Stage.align = "LT"; import flash.display.*; function loadBitmapSmoothed(url:String, target:MovieClip) { var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth()); var listener:Object = new Object(); listener.tmc = target; listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { percent = Math.round((bytesLoaded/bytesTotal)*100); pText.text = percent+"%"; }; listener.onLoadInit = function(mc:MovieClip) { mc._alpha = 0; mc.onEnterFrame=function () { mc._alpha += 15; if(mc._alpha >= 100) { delete this.onEnterFrame; } var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true); this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), "auto", true); bitmap.draw(mc); // set size and position on load if (Stage.height/Stage.width>target._height/target._width) { img_prop = target._width/target._height; target._height = Stage.height; target._width = Stage.height*img_prop; target._y = (Stage.height/2)-(target._height/2); target._x = (Stage.width/2)-(target._width/2); } else { img_prop = target._height/target._width; target._width = Stage.width; target._height = Stage.width*img_prop; target._y = (Stage.height/2)-(target._height/2); target._x = (Stage.width/2)-(target._width/2); }} }; var loader:MovieClipLoader = new MovieClipLoader(); loader.addListener(listener); loader.loadClip(url, bmc); } loadBitmapSmoothed("images/image1.jpg", bg_con); // set size and position on resize var stageL:Object = new Object(); stageL.onResize = function():Void { if (Stage.height/Stage.width>bg_con._height/bg_con._width) { cover._x = Math.round(Stage.width - Stage.width); cover._y = Math.round(Stage.height / 2); address._x = Stage.width / 2; address._y = Stage.height - 30; header._width = Stage.width; footer._width = Stage.width; footer._y = Stage.height; img_prop = bg_con._width/bg_con._height; bg_con._height = Stage.height; bg_con._width = Stage.height*img_prop; bg_con._y = (Stage.height/2)-(bg_con._height/2); bg_con._x = (Stage.width/2)-(bg_con._width/2); } else { cover._x = Math.round(Stage.width - Stage.width); cover._y = Math.round(Stage.height / 2); address._x = Stage.width / 2; address._y = Stage.height - 30; header._width = Stage.width; footer._width = Stage.width; footer._y = Stage.height; img_prop = bg_con._height/bg_con._width; bg_con._width = Stage.width; bg_con._height = Stage.width*img_prop; bg_con._y = (Stage.height/2)-(bg_con._height/2); bg_con._x = (Stage.width/2)-(bg_con._width/2); } }; Stage.addListener(stageL); cover._x = Math.round(Stage.width - Stage.width); cover._y = Math.round(Stage.height / 2); address._x = Stage.width / 2; address._y = Stage.height - 30; header._width = Stage.width; footer._width = Stage.width; footer._y = Stage.height; footer._y = Stage.height;
Also further down the timeline I want to be able to add an image I directly target which I have been able to achieve by placing this on the timeline...Code:var myTest = random(6) + ".jpg"; // Load 1 of 6 random images
_root.loadBitmapSmoothed("images/image1.jpg", _root.bg_con);
Any help would be greatly appreciated!




Bookmarks