Please download my file here : http://www.djboudicca.com/lin_flash.zip
Hi there everyone…
Thanks for taking the time to check this out. I’m a multimedia student (struggling) to get this assignment done in AS 3.0…
My assignment has to be done only in AS 3.0…
Basically, you need to open up the main.fla to see what I mean…
* main.swf - holds the main website menu
* articles.swf - is one of the swfs which get loaded into main.swf (via the main.swf main menu)
THE PROBLEM : Articles.swf has another ‘sub-menu’ containing links to article1.swf, article2.swf and arcticle3.swf. I’ve tried to use the ‘same logic’ as main.swf to do the loading of article1.swf etc into articles.swf… It just doesn’t work when I try to access articles.swf from main.swf. Maybe it’s clashing with the code used in main.swf?
However when I open up articles.fla and ‘Test movie’ all the article1.swf etc load into it perfectly, just doesn’t want to function when entered from main.swf…
THE CODE I USED IN MAIN.SWF TO LOAD all other swfs :
// setup labels on the dynamic buttons
home_btn.setLabel("home");
articles_btn.setLabel("articles");
gallery_btn.setLabel("gallery");
contact_btn.setLabel("contact");
promoSignUp_btn.setLabel("sign up here");
//setup array to load in different page content
var clips:Array = ["home.swf", "articles.swf", "gallery.swf","contact.swf","promoSignUp.swf"];
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Even t.INIT, doneLoading);
var loaded_mc:MovieClip = new MovieClip();
stage.addChild(loaded_mc);
function doneLoading(event:Event) {
stage.removeChild(loaded_mc);
loaded_mc = MovieClip(thisLoader.content);
thisLoader.unload();
stage.addChild(loaded_mc);
loaded_mc.x=150;
loaded_mc.y=150;
loaded_mc.gotoAndPlay(1);
}
thisLoader.load(new URLRequest(clips[0]));
home_btn.addEventListener(MouseEvent.CLICK, loadHome);
function loadHome(event:MouseEvent){
//FIRST RESET ALL OTHER BUTTONS
//ie. release any other buttons if they have been selected/clicked
//and left in a "down" state
//ie. put all other buttons in the "up" state
//+ set the buttons' variable 'clicked' to 'false'
//[this is done within each button in the 1st frame]
articles_btn.gotoAndStop("up")
gallery_btn.gotoAndStop("up")
contact_btn.gotoAndStop("up")
promoSignUp_btn.gotoAndStop("up")
//load the "home.swf" file, 1st element [0] in the array
thisLoader.load(new URLRequest(clips[0]));
}
articles_btn.addEventListener(MouseEvent.CLICK, loadArticles);
function loadArticles(event:MouseEvent){
//FIRST RESET ALL OTHER BUTTONS
home_btn.gotoAndStop("up")
gallery_btn.gotoAndStop("up")
contact_btn.gotoAndStop("up")
promoSignUp_btn.gotoAndStop("up")
//load the "articles.swf" file, 2nd element [1] in the array
thisLoader.load(new URLRequest(clips[1]));
}
gallery_btn.addEventListener(MouseEvent.CLICK, loadGallery);
function loadGallery(event:MouseEvent){
//FIRST RESET ALL OTHER BUTTONS
home_btn.gotoAndStop("up")
articles_btn.gotoAndStop("up")
contact_btn.gotoAndStop("up")
promoSignUp_btn.gotoAndStop("up")
//load the "gallery.swf" file, 3rd element [2] in the array
thisLoader.load(new URLRequest(clips[2]));
}
contact_btn.addEventListener(MouseEvent.CLICK, loadContact);
function loadContact(event:MouseEvent){
//FIRST RESET ALL OTHER BUTTONS
home_btn.gotoAndStop("up")
articles_btn.gotoAndStop("up")
gallery_btn.gotoAndStop("up")
promoSignUp_btn.gotoAndStop("up")
//load the "contact.swf" file, 4th element [3] in the array
thisLoader.load(new URLRequest(clips[3]));
}
promoSignUp_btn.addEventListener(MouseEvent.CLICK, loadPromoSignUp);
function loadPromoSignUp(event:MouseEvent){
//FIRST RESET ALL OTHER BUTTONS
home_btn.gotoAndStop("up")
articles_btn.gotoAndStop("up")
gallery_btn.gotoAndStop("up")
contact_btn.gotoAndStop("up")
//load the "promoSignUp.swf" file, 5th element [4] in the array
thisLoader.load(new URLRequest(clips[4]));
}
**
THE CODE I USED IN ARTICLES.SWF TO LOAD article1.swf, article2.swf and article3.swf :**
// setup labels on the dynamic buttons
article1_btn.setLabel("DJ Bare Essentials vol 1");
article2_btn.setLabel("Bit of headspace");
article3_btn.setLabel("article3");
//setup array to load in different page content
var clips:Array = ["article1.swf", "article2.swf", "article3.swf"];
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Even t.INIT, doneLoading);
var loaded_mc:MovieClip = new MovieClip();
stage.addChild(loaded_mc);
function doneLoading(event:Event) {
stage.removeChild(loaded_mc);
loaded_mc = MovieClip(thisLoader.content);
thisLoader.unload();
stage.addChild(loaded_mc);
loaded_mc.x=0;
loaded_mc.y=0;
loaded_mc.gotoAndPlay(1);
}
thisLoader.load(new URLRequest(clips[0]));
article1_btn.addEventListener(MouseEvent.CLICK, loadArticle1);
function loadArticle1(event:MouseEvent) {
//FIRST RESET ALL OTHER BUTTONS
//ie. release any other buttons if they have been selected/clicked
//and left in a "down" state
//ie. put all other buttons in the "up" state
//+ set the buttons' variable 'clicked' to 'false'
//[this is done within each button in the 1st frame]
article2_btn.gotoAndStop("up");
article3_btn.gotoAndStop("up");
//load the "article1.swf" file, 1st element [0] in the array
thisLoader.load(new URLRequest(clips[0]));
}
article2_btn.addEventListener(MouseEvent.CLICK, loadArticle2);
function loadArticle2(event:MouseEvent) {
//FIRST RESET ALL OTHER BUTTONS
article1_btn.gotoAndStop("up");
article3_btn.gotoAndStop("up");
//load the "article2.swf" file, 2nd element [1] in the array
thisLoader.load(new URLRequest(clips[1]));
}
article3_btn.addEventListener(MouseEvent.CLICK, loadArticle3);
function loadArticle3(event:MouseEvent) {
//FIRST RESET ALL OTHER BUTTONS
article1_btn.gotoAndStop("up");
article2_btn.gotoAndStop("up");
//load the "article3.swf" file, 3rd element [2] in the array
thisLoader.load(new URLRequest(clips[2]));
}
stop();
I would be very grateful for any help you can offer me…!!
Many thanks
BeeDee