Jump to content
Search Community

loading a SWFs Child SWFs Child

Harvid test
Moderator Tag

Recommended Posts

Hey

have a loader then ends in a loader, so people will see 2 loader sequence in a road. not goot at all.

I'm Looking For a solution for it wet loadermax. like the preloader.swf loads - startmeny.swf and its first childe About.swf

 

i have seen the requireWithRoot. bot i don't understand it, and i cannot finde any (copy /paste) examples to figure it out

cut you please show me a loader wits has it incorporated, or maby you hav a better idea how to do it ?

 

agen sorry for my bad english

Link to comment
Share on other sites

its dreving me crasy

 

i found this post

Once your SWFLoader fires its INIT event, that means it has loaded enough to look for loaders in the swf and begin loading them (if any are found). You can get any loader by name or url using LoaderMax.getLoader(). The latest version of LoaderMax (updated today) has a new "loadTime" property for all loaders which tells you how many seconds it took to load. So let's say you have a loader named "childLoader" inside your child swf that the SWFLoader is loading - you could get that like this:

 

 

Code: Select all

var loader:SWFLoader = new SWFLoader("child.swf", {onInit:initHandler, onComplete:completeHandler});

 

function initHandler(event:LoaderEvent):void {

var childLoader:LoaderMax = LoaderMax.getLoader("childLoader") as LoaderMax;

trace("found " + childLoader);

}

 

function completeHandler(event:LoaderEvent):void {

var childLoader:LoaderMax = LoaderMax.getLoader("childLoader") as LoaderMax;

trace("childLoader took " + childLoader.loadTime + " seconds to load " + childLoader.bytesTotal + " bytes.");

}

 

loader.load();

Does that answer your question?

and its don't seems to work

 

in my loader the code is

 

import com.greensock.*;  
import com.greensock.loading.*;  
import com.greensock.events.LoaderEvent;  
import com.greensock.loading.display.*;

var loader:SWFLoader = new SWFLoader("a33.swf", {onInit:initHandler, onComplete:completeHandler});
addChild(loader.content)
function initHandler(event:LoaderEvent):void {
   var childLoader:LoaderMax = LoaderMax.getLoader("childLoader") as LoaderMax;
//    trace("found " + childLoader);
}

function completeHandler(event:LoaderEvent):void {
   var childLoader:LoaderMax = LoaderMax.getLoader("childLoader") as LoaderMax;
//    trace("childLoader took " + childLoader.loadTime + " seconds to load " + childLoader.bytesTotal + " bytes.");
trace("completeHandler complete");
}

loader.load();

in my childe loader the code is

import com.greensock.*;  
import com.greensock.loading.*;  
import com.greensock.events.LoaderEvent;  
import com.greensock.loading.display.*;

var childLoader:SWFLoader = new SWFLoader("a22.swf",{onComplete:completeHandler});
addChild(childLoader.content)
function completeHandler(event:LoaderEvent):void {  
var image:ContentDisplay = LoaderMax.getContent("a22.swf");  
TweenLite.to(image, 1, {alpha:1});  
trace(event.target + " is complete!");
}
childLoader.load();

 

if i trace the

trace("childLoader took " + childLoader.loadTime + " seconds to load " + childLoader.bytesTotal + " bytes.");

trace("found " + childLoader);

 

i get a error

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at loader_fla::MainTimeline/completeHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at com.greensock.loading.core::LoaderCore/_completeHandler()

at com.greensock.loading::SWFLoader/_completeHandler()

SWFLoader 'loader1' (a22.swf) is complete!

 

and if skipping errors traces

 

completeHandler complete

SWFLoader 'loader1' (a22.swf) is complete!

 

its seems to load the child's afterwards !

 

please help me

Link to comment
Share on other sites

Several problems:

 

1) You didn't set the requireWithRoot on the childLoader.

 

2) You were using LoaderMax.getLoader("childLoader") but you never created a loader that was named "childLoader", so that returned null. It would of worked if you did LoaderMax.getLoader("a22.swf") but it's equally easy to just name your SWFLoader "childLoader".

 

3) You were data typing the returned value of LoaderMax.getLoader() as a LoaderMax, but that childLoader wasn't a LoaderMax - it was a SWFLoader. In Flash, if you cast something as a type that doesn't fit, it just nulls the value.

 

I've attached a fixed set of files.

Link to comment
Share on other sites

i trying to incorporate the code in my project

a22.swf don't seems to be a part of the queue1 in loader.swf

 

my traces:

found SWFLoader 'childLoader' (a22.swf)

childLoader took 0.003 seconds to load 20000 bytes.

completeHandler don

SWFLoader 'childLoader' (a22.swf) is complete!

Link to comment
Share on other sites

Ah, the Adobe TLF bug strikes again! The problem has to do with Adobe doing some funky stuff under the hood whenever you use TLF - their Loader doesn't properly report the content. I just updated LoaderMax to work around that issue, though. Please download the latest version and give it another shot.

Link to comment
Share on other sites

  • 3 weeks later...
Guest ekdalen

many thanks!!! i ran into this issue today and it drove me nuts. only when i removed the entire TLF code it worked. update -> solved!

 

point is: only after removing the TLF I found this forum post by the terms of what i found out.... ;-p

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...