-
Working with UILoader
I'm using 2 UILoader components on an application, and I want the second one to start loading as soon as the first one is finished, and the 3rd after the second is finished loading...
I'm using this code for the first two, but both of them start loading at the same time:
Code:
import fl.containers.UILoader;
var loader_1:UILoader = new UILoader();
loader_1.source = "001.swf";
loader_1.x = 0;
loader_1.y = 10;
loader_1.scaleContent = false;
addChild(loader_1);
loader_1.addEventListener(Event.COMPLETE, completed1);
function completed1(e:Event) {
var loader_2:UILoader = new UILoader();
loader_2.source = "002.swf";
loader_2.x = 70;
loader_2.y = 10;
loader_2.scaleContent = false;
addChild(loader_2);
}
loader_2.addEventListener(Event.COMPLETE, completed2);
function completed2(e:Event) {
}
I should add that each swif is about 200kb and has a prealoder of its own.
-
Senior Member
Have you tested this online or only on your harddrive? 200kb is nothing.
- The right of the People to create Flash movies shall not be infringed. -
-
I used the stimulate download function.
The second movie starts preloading approximately when the first one is about 16% loaded.
-
Senior Member
You may want to recheck your preloader. It may not accurately show the loading.
- The right of the People to create Flash movies shall not be infringed. -
-
the preloader works just fine on its own.
this is the code for preloader:
Code:
var imageLoader:Loader;
function loadImage(url:String):void {
preloader.visible = true;
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
loadImage("001.jpg");
function imageLoaded(e:Event):void {
imageLoadArea.addChild(imageLoader);
preloader.visible = false;
}
function imageLoading(e:ProgressEvent):void {
var loaded:Number = e.bytesLoaded / e.bytesTotal;
var perc:Number = e.bytesLoaded / e.bytesTotal;
preloader.percentn.text = Math.ceil(perc*100).toString();
preloader.SetProgress(loaded);
}
I should maybe add that the external swif is in fact loading a .jpg
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
|