Jump to content
Search Community

LoaderMax in Document Structure

soupking test
Moderator Tag

Recommended Posts

Hi Jack,

 

I'm trying to incorporate LoaderMax into my "header" class as a "loader" class. Well, actually I'm first trying to simplify that by just loading the "loader" class straight into the FLA.

 

However, no matter what I do it wants to instance it as a MovieClip. ??

 

Here's the code:

 

package  {

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


public class TheLoader {


	public function TheLoader() {
		//create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners
		var queueXML:LoaderMax = new LoaderMax({name:"xmlQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
		//append several loaders
		queueXML.append( new XMLLoader("_xml/menu3.xml", {name:"xmlDoc"}) );

		function progressHandler(event:LoaderEvent):void {
			trace("progress: " + event.target.progress);
		}
		function completeHandler(event:LoaderEvent):void {
			trace(event.target + " is complete!");
		}
		function errorHandler(event:LoaderEvent):void {
			trace("error occured with " + event.target + ": " + event.text);
		}
	}
}

}

 

What am I missing/need to remove? I'm not sure where the logic disconnect is.

Link to comment
Share on other sites

However, no matter what I do it wants to instance it as a MovieClip. ??

 

What do you mean it wants to "instance it as a MovieClip"?

 

I noticed you never call load() on the queueXML and you're using nested functions for the onComplete, onProgress, and onError - that's typically a bad idea because nested functions are deleted as soon as the parent function finishes running. I'm still unclear as to what the problem is with the "instance it as a MovieClip" thing. Mind posting an example that demonstrates the issue?

Link to comment
Share on other sites

Doh!

 

Gosh, how amateur of me. I typically never do nested functions, my bad. I changed that now. I knew better than that.

 

This is what it keeps telling me though:

 

/Volumes/G-DRIVE mini/_main/_suitcase/_classes/_mine/com/TheLoader.as, Line 1 5000: The class 'TheLoader' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

 

...How? Is there some library I'm importing that involves movieclips?

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...