Skip to main content
Inspiring
July 11, 2007
Question

trying to preload swfs

  • July 11, 2007
  • 9 replies
  • 794 views
Hello,

i have a main swf that i'm trying to preload other swf's into. i'm trying to add a Listener to the MovieClipLoader. i'm using flash cs3 and got the code from livedocs here: http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001993.html here">here

here's my code


this.createEmptyMovieClip("swf_mc", 999);
var myMCL:MovieClipLoader = new MovieClipLoader();

//create the listener object

var mcListener:Object = new Object();

mcListener.onLoadError = function(target_mc:MovieClip, errorCode:String, status:Number) {
trace("error loading: " + errorCode + " " + status);
}
mcListener.onLoadStart = function(target_mc:MovieClip){
trace("onLaodStart: " + target_mc);
}
mcListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number) {
var numPercentLoaded:Number = numBytesTotal / numBytesLoaded * 100;
trace("bytes loaded: " + numPercentLoaded + "% " + " of " + numBytesTotal);
}

mcListener.onLoadComplete = function(target_mc:MovieClip, status:Number) {
trace("onLoadComplete: " + target_mc);
}

myMCL.addListener(mcListener);

myMCL.loadClip("dante_montage.swf", swf_mc);


i get error messages:

1046: Type was not found or was not a compile-time constant: MovieClipLoader.
for the following line of code-
var myMCL:MovieClipLoader = new MovieClipLoader();

and i get this message:
1180: Call to a possibly undefined method MovieClipLoader.
for this line of code-
myMCL.loadClip("dante_montage.swf", swf_mc);


thanks!
This topic has been closed for replies.

9 replies

Inspiring
July 12, 2007
awesome!!!!!!!

i also found this link if anybody is interested, seems like there's a bit of confusion between the old loader and the new Loader in AS 3.0

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html

thanks dzedward!
Inspiring
July 12, 2007
i understand that code but what i want to do is add a listener to the load so i can display the load progress. any links you could give me that explain how to display the load progress of the Loader object would be awesome :) thanks
Damon Edwards
Inspiring
July 12, 2007
:
Damon Edwards
Inspiring
July 12, 2007
do a google search, this is straight from Adobe

var request:URLRequest = new URLRequest(" http://www.[yourdomain
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
Inspiring
July 12, 2007
while we're on the topic of the Loader class replacing the MovieClipLoader, you have any links to tutorials on the Loader class? thanks!
Damon Edwards
Inspiring
July 12, 2007
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html

scroll the Class for the Loader class, it has replaced MovieClipLoader
Inspiring
July 12, 2007
that worked :) thanks...

i think the confusion came from me searching out "preloading swf's in cs3" - assuming only actionscript 3.0 documents would show up. i figured it would be a good idea to stay current with actionscript.

could anybody point me to an AS 3.0 example of doing this?
Inspiring
July 12, 2007
ok, i'll test it in a AS 2 document thanks :)
Inspiring
July 12, 2007
It looks likes you are writing an AS2 snippet in an AS3 document.
Inspiring
July 11, 2007
it appears that flash is not recognizing the MovieClipLoader class. anybody know a way that i can confirm that...?