# Loading structure for large conent site AS3

**URL:** <https://forum.kirupa.com/t/loading-structure-for-large-conent-site-as3/291650>\
**Category:** flash\
**Created:** [July 2, 2009, 7:38pm UTC](https://forum.kirupa.com/t/loading-structure-for-large-conent-site-as3/291650 "2009-07-02T19:38:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jotte](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jotte](https://forum.kirupa.com/u/jotte)\
**Post date:** [July 2, 2009, 7:38pm UTC](https://forum.kirupa.com/t/loading-structure-for-large-conent-site-as3/291650/1 "2009-07-02T19:38:27Z")

</div>

[SIZE=2]Hi![/SIZE]

[SIZE=2]I am a beginner in AS3 with medium experience of AS2.[/SIZE]  
[SIZE=2]I have built a large e-learningsite for drummer’s [www.learningdrum.com](http://www.learningdrum.com) in AS2.[/SIZE]

[SIZE=2]The overall goal structure in the AS2 project has been:[/SIZE]  
[SIZE=2]1. Keep the content divided into Modules,Chapters, and Scenes.[/SIZE]  
[SIZE=2]2. Have enough stage space to add on a large number of modules, chapters, and scenes.[/SIZE]  
[SIZE=2]3. Keep the preload time short by loading external chapters.swf into conentholder\_mc with [/SIZE]

[SIZE=2]unloadMovie(":\_root.movHolder\_mc"); and loadMovie(“chapter1.swf”,":\_root.movHolder\_mc");.[/SIZE]

[SIZE=2]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. [/SIZE]

[SIZE=2]These are the goals for the AS3 project.[/SIZE]  
[SIZE=2]1. Keep the large amount of content and user interface divided into Modules,Chapters and Scenes.[/SIZE]  
[SIZE=2]2. Have enough stage space to add on a large number of modules, chapters and scenes.[/SIZE]  
[SIZE=2]3. Keep the preload time short.[/SIZE]  
[SIZE=2]4. Make the site easy to update, add on new chapters and scenes.[/SIZE]

[SIZE=2]MY ALTERNATIVE 1:[/SIZE]  
[SIZE=2]When I read about loading external chapter.swf files into AS3 projects this code was recommended.[/SIZE]

[SIZE=2]function startloadmc(evt:MouseEvent):void{[/SIZE]  
[SIZE=2]var ldr:Loader = new Loader();[/SIZE]  
[SIZE=2]ldr.load(new URLRequest(“kapitel.swf”)); // With string[/SIZE]  
[SIZE=2]ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded,false,0,true);[/SIZE]  
[SIZE=2]function loaded(evt:Event):void {[/SIZE]  
[SIZE=2]addChild(evt.target.content);[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]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.[/SIZE]

[SIZE=2]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.[/SIZE]

[SIZE=2]MY ALTERNATIVE 2:[/SIZE]  
[SIZE=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[/SIZE]  
[SIZE=2]var chapter1:MovieClip = new Chapter1linkageclassname();[/SIZE]  
[SIZE=2]this.addChild(chapter1);[/SIZE]

[SIZE=2]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.[/SIZE]

[SIZE=2]QUESTION:[/SIZE]  
[SIZE=2]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?[/SIZE]

[SIZE=2]Thanks for your input in this matter![/SIZE]  
[SIZE=2]/ Jotte[/SIZE]
