jotte
July 2nd, 2009, 03:38 PM
Hi!
I am a beginner in AS3 with medium experience of AS2.
I have built a large e-learningsite for drummer’s www.learningdrum.com (http://www.learningdrum.com) in AS2.
The overall goal structure in the AS2 project has been:
1. Keep the content divided into Modules,Chapters, and Scenes.
2. Have enough stage space to add on a large number of modules, chapters, and scenes.
3. Keep the preload time short by loading external chapters.swf into conentholder_mc with
unloadMovie(":_root.movHolder_mc"); and loadMovie("chapter1.swf",":_root.movHolder_mc");.
I am planning to migrate the project from AS2 to AS3, I will probably need to rewrite the most of the code, but that is OK, I will learn a lot.
These are the goals for the AS3 project.
1. Keep the large amount of content and user interface divided into Modules,Chapters and Scenes.
2. Have enough stage space to add on a large number of modules, chapters and scenes.
3. Keep the preload time short.
4. Make the site easy to update, add on new chapters and scenes.
MY ALTERNATIVE 1:
When I read about loading external chapter.swf files into AS3 projects this code was recommended.
function startloadmc(evt:MouseEvent):void{
var ldr:Loader = new Loader();
ldr.load(new URLRequest("kapitel.swf")); // With string
ldr.contentLoaderInfo.addEventListener(Event.COMPL ETE,loaded,false,0,true);
function loaded(evt:Event):void {
addChild(evt.target.content);
}
}
The loading process seems to work but when I want to UNLOAD that var ldr and LOAD another chapter2.swf I cant get it to work.
The AS2 option to access variables in root.fla file from other loaded MCs with _level0.easytoreachvariable is not longer available in AS3, which makes it also more difficult.
MY ALTERNATIVE 2:
I have thought about making my chapter.swfs to MovieClips in the library of the same root.fla file, and adding them to the stage by adding and removing child with
var chapter1:MovieClip = new Chapter1linkageclassname();
this.addChild(chapter1);
But this setup load all flash library MC in the first frame of the main timeline and because I have a lot of content this will create to long preload time when entering the site.
QUESTION:
If you are an experienced AS3 programmer, are any of my alternatives 1 or 2 recommended for a site this large or do you have some other solution to load this large amount of content and keeping the preload times short, using AS3?
Thanks for your input in this matter!
/ Jotte
I am a beginner in AS3 with medium experience of AS2.
I have built a large e-learningsite for drummer’s www.learningdrum.com (http://www.learningdrum.com) in AS2.
The overall goal structure in the AS2 project has been:
1. Keep the content divided into Modules,Chapters, and Scenes.
2. Have enough stage space to add on a large number of modules, chapters, and scenes.
3. Keep the preload time short by loading external chapters.swf into conentholder_mc with
unloadMovie(":_root.movHolder_mc"); and loadMovie("chapter1.swf",":_root.movHolder_mc");.
I am planning to migrate the project from AS2 to AS3, I will probably need to rewrite the most of the code, but that is OK, I will learn a lot.
These are the goals for the AS3 project.
1. Keep the large amount of content and user interface divided into Modules,Chapters and Scenes.
2. Have enough stage space to add on a large number of modules, chapters and scenes.
3. Keep the preload time short.
4. Make the site easy to update, add on new chapters and scenes.
MY ALTERNATIVE 1:
When I read about loading external chapter.swf files into AS3 projects this code was recommended.
function startloadmc(evt:MouseEvent):void{
var ldr:Loader = new Loader();
ldr.load(new URLRequest("kapitel.swf")); // With string
ldr.contentLoaderInfo.addEventListener(Event.COMPL ETE,loaded,false,0,true);
function loaded(evt:Event):void {
addChild(evt.target.content);
}
}
The loading process seems to work but when I want to UNLOAD that var ldr and LOAD another chapter2.swf I cant get it to work.
The AS2 option to access variables in root.fla file from other loaded MCs with _level0.easytoreachvariable is not longer available in AS3, which makes it also more difficult.
MY ALTERNATIVE 2:
I have thought about making my chapter.swfs to MovieClips in the library of the same root.fla file, and adding them to the stage by adding and removing child with
var chapter1:MovieClip = new Chapter1linkageclassname();
this.addChild(chapter1);
But this setup load all flash library MC in the first frame of the main timeline and because I have a lot of content this will create to long preload time when entering the site.
QUESTION:
If you are an experienced AS3 programmer, are any of my alternatives 1 or 2 recommended for a site this large or do you have some other solution to load this large amount of content and keeping the preload times short, using AS3?
Thanks for your input in this matter!
/ Jotte