Jump to content
Search Community

Another noob question (sorry)

acto test
Moderator Tag

Recommended Posts

Hi,

 

I know this is a documented issue, I read the tips section but I still can't figure out how to do this, maybe it's because I'm tired, maybe it's because I'm still a noob... Sorry for this question but could you please help me figure this out?

 

I have a main movie into which I load swfs, what I want to do is: from my main movie (by clicking a button) I want to call a function that is in one of the loaded swfs... I tried the rawContent method but I'm getting errors, could you please help me figure this out?

 

Thank you and sorry again for asking noob questions,

 

acto

 

This is my code:

 


var queue:LoaderMax = new LoaderMax({name:"mainQueue"});

//MAIN SECTIONS
queue.append( new SWFLoader("com/sections/credits.swf", {name:"credits", container:container1,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/home.swf", {name:"homz", container:container2,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/section_01.swf", {name:"oswiecenie", container:container3,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/section_02.swf", {name:"XIX", container:container4,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/section_03.swf", {name:"20Lecie", container:container5,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/section_04.swf", {name:"zaglada", container:container6,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/sections/section_05.swf", {name:"PRL", container:container7,  onProgress:progressHandler, onComplete:completeHandler}) );


//PLUS MENU
queue.append( new SWFLoader("com/pMenu/bibliografia.swf", {name:"bibli", container:container8,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/pMenu/slownik.swf", {name:"slownik", container:container9,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/pMenu/pdfy.swf", {name:"PDF", container:container10,  onProgress:progressHandler, onComplete:completeHandler}) );
queue.append( new SWFLoader("com/maps/warsaw.swf", {name:"warsaw", container:container11,  onProgress:progressHandler, onComplete:completeHandler}) );


function progressHandler(event:LoaderEvent):void {
Object(root).progressBar.visible = true;
Object(root).progressTxt.visible = true;
var percent:int = event.target.progress*100
//    trace("progress: " + event.target.progress);
progressBar.setProgress(event.target.progress, 1)
progressTxt.text = String("Trwa ładowanie: " + percent + " %");
}

function completeHandler(event:LoaderEvent):void {
var image:ContentDisplay = event.target.content;
Object(root).progressBar.visible = false;
Object(root).progressTxt.visible = false;
//    trace(event.target + " is complete!");

}


//FUNCTIONS TO --->> LOADED SWFS

function goBackToRoot(): void { // this function is called when I press my button in my main SWF

function onLoadSWF(event:LoaderEvent):void {
   var loadedMc:MovieClip = container3.rawContent;
   loadedMc.backToRoot(); // backToRoot(); is the function inside my loaded swf that I want to call from my main swf

}
}

Link to comment
Share on other sites

you are very close. rawContent is a property of the SWFLoader, not the container that the swf gets loaded into.

 

try this:

 

 

 

function onLoadSWF(event:LoaderEvent):void {

LoaderMax.getLoader("oswiecenie").rawContent.backToRoot();

 

}

 

 

it looks like in your code the above function is nested inside goBackToRoot, which could cause problems.

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