myloads

Trouble coding external SWFs

As I have multiple SWFs I have imported them into the library. There are numerous snippets of code available online or on Flash CC itself however, I am unsure which one to go for. I have a choice of having the animations play in the app space or opening up externally however, I am having trouble stopping the streaming sounds/ song when played in the app. I will continue to research this problem however for now I have decided to keep the SWF links external to enable no bugs and overwritten code. 

Options 

SUGGESTED CODE:

var myLoader:Loader = new Loader();                     // create a new instance of the Loader class

var url:URLRequest = new URLRequest(“ExternalSWF.swf”); // in this case both SWFs are in the same folder

myLoader.load(url);                                     // load the SWF file

addChild(myLoader);                                     // add that instance to the display list, adding it to the Stage at 0,0

 // (optional)

myLoader.x = 10;                                        // move the loaded SWF 10 pixels to the right (from the left edge)  

myLoader.y = 175;                                       // move the loaded SWF 175 pixels down from the top


CODE THAT WORKED BUT LOADED INTO ANOTHER TAB:

song_btn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e: MouseEvent): void {

           navigateToURL(new URLRequest(“COMM3710-200702796-SafeSurfingSong.swf”), “_self”);

}


WORKED IN APP BUT CANT STOP SOUND:

song_btn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e: MouseEvent): void

{

var myLoader: Loader = new Loader(); // create a new instance of the Loader class

var url: URLRequest = new URLRequest(“COMM3710-200702796-SafeSurfingSong.swf”); // in this case both SWFs are in the same folder

myLoader.load(url); // load the SWF file

addChild(myLoader); // add that instance to the display list, adding it to the Stage at 0,0 

// (optional)

myLoader.x = 300; // move the loaded SWF 10 pixels to the right (from the left edge)  

myLoader.y = 175; // move the loaded SWF 175 pixels down from the top

}

His pledge to her:
I will kill the spiders. I will share my fries with you when you’ve finished all yours and are still hungry. i won’t ever pop my collar.  I will never be rude to your tummy- when i hear it growl and gurgle, i promise to bend down and reply respectfully. i will eat the mushrooms when we order the supreme pizza. i will kiss the papercuts. and the door-slammed finger. and the counter-bumped hip. i’ll try my hardest not to get annoyed when you whisper questions and comments during movies. i will be the big spoon. i will let you win at wrestling. sometimes. other times i will not. i will go faster. harder. i will pull when you want. and tease you when you don’t. i will send you random texts and leave you silly gifts. not always. not on schedule. just whenever i want to. whenever i think you need one. or seven. i will check your tire pressure. and remind you to take your car in. i will hold your hand. i will love you. i will love you. i will love you.