I’m looking to load random backgroud jpg’s into a Flash movie upon load. These images will just sit there looking pretty. Ultimately, I will likely have an additional image with a higher “depth” that I will set a blend mode on – blending with the stationary background images.
My questions:
[LIST=1]
[]Is a loader instance the best “container” for this approach?
[]Would using a Sprite be a better practice & why?
[]Commonplace to put loader instances inside(as children) of sprites? – beneficial here?
[]Anything wrong with sending various images to the same loader instance or is that the logical solution?
[/LIST]
Thanks
working test so far
//constructors
var imgLoader:Loader = new Loader();
var sRequest:URLRequest = new URLRequest("images/bg/plants.jpg");
//event handle
imgLoader.addEventListener(Event.COMPLETE, onComplete);
imgLoader.load(sRequest);
addChild(imgLoader);
function onComplete(evtObj:Event):void{
trace("loaded");
}
//----------------------------------------------------
//test button to verify multiple images go into single loader
var spr:Sprite = new Sprite();
spr.graphics.beginFill(0xFF0000, 1);
spr.graphics.drawRect(0,0, 100, 22);
spr.graphics.endFill();
var btn:SimpleButton = new SimpleButton();
btn.upState = spr;
btn.overState = spr;
btn.downState = spr;
btn.hitTestState = spr;
btn.useHandCursor = true;
btn.x = 20;
btn.y = 20;
btn.addEventListener(MouseEvent.CLICK, clickHandler);
addChild(btn);
function clickHandler(event:MouseEvent):void {
imgLoader.load(new URLRequest("images/bg/tulips.jpg"));
}