ActionScript 3.0 :: Unload External SWF Before Loading New One
Feb 4, 2009
I am building a portfolio, but lately I've been experienced some annoying problems with loading external swfs into a container. Everything works like charm, but when I load new clips into the container, they are just put on top of the old ones - which I naturally don't want to happened. This is the current coding I use for two of the different links. I pressume that one solution would be to add a removeChild, but I've not succeeded placing this in the right place yet.
ActionScript Code:
fashionBTN.addEventListener(MouseEvent.CLICK,fashionBN);
function fashionBN(event: MouseEvent) {
var goFashion =new Loader();
goFashion.load(new URLRequest('fashionPRE.swf'));
contentsMC.addChild(goFashion) }
[Code] .....
View 9 Replies
Similar Posts:
Feb 11, 2010
My project is PC software and not related to web.It contains of Main menu and 3 external SWF (Total 4 Files).Inside the Main-Menu 3 buttons , when the user click on button # 1 or # 2 or # 3 I want a code to unload the main menu first then open external swf # 1 or #2 or #3 depending on which button user click.I use this code to load the external SWF:
Code:
var myLoader:Loader = new Loader;
addChild(myLoader);
var url:URLRequest = new URLRequest("f1.swf");
myLoader.load(url);
Its working fine but the problem it load the external swf with the main menu in the same time! what I want a code first unload Main-menu then loading external swf. and another code in external SWFs to exit to Main-Menu with ofcorse unload the swf first then exit to main-menu.
View 5 Replies
Jul 23, 2009
I'm trying to unload an external SWF on _root to load a new one instead. I've tried (almost) everything but can't figure it out... I get this error : "Error #1010: A term is undefined and has no properties."
[Code]....
View 3 Replies
Mar 7, 2005
do i need to "unload" my external swf, before loading up a new one? i was testing outm y movie, and i was noticing that things were getting a little slow, and i wasn't sure if it was becasue of my computer, or of the movie.
View 3 Replies
Mar 7, 2005
okay, so i figured out the previous issue that i had, but i have another question. do i need to "unload" my external swf, before loading up a new one? i was testing outm y movie, and i was noticing that things were getting a little slow, and i wasn't sure if it was becasue of my computer, or of the movie.
View 2 Replies
Aug 15, 2011
[URL]I have: main.swf (a menu) and I have module.swf (content)If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent. So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
var bigboreLoader:Loader = new Loader();btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf"); bigboreLoader.load(bigboreRequest); stage.addChild(bigboreLoader);
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
Main FLA:
function removeF() {
removeChild(bigboreLoader);
}
[code]....
View 10 Replies
Jun 13, 2010
I'm sure this question has been answered but I have been looking everywhere and all I can find is how to load an external SWF but not how to unload it. I come from a basic knowledge of AS2 and it was easy for me to load using levels but I have run into a wall. I have a main swf and to keep the initial filesize small I would like to split some image intensive sections out and load them when needed.
View 6 Replies
Apr 12, 2009
My index page has two buttons... 'about' and 'portfolio' which loads each respective external swf into a holder.When 'portfolio' is loaded there are another 8 buttons which again load 8 external swfs into a holder in the portfolio.swf. Each of the 8 external swf files load fine, but is there anyway to have a back button instead in each of the 8 external swf to go back to the portfolio.swf without having to click the 'portfolio' button?i have tried _root.unloadMovie.... but it just clears the stuff on my index page and loads the portfolio.swf
View 1 Replies
Mar 18, 2010
i am trying to create a file where a mc hittest another object(using keyboard arrow) it loads an external swf and when keypress to leave the object, it will unload the external swf. my problem is the external swf did load but it wont unload. attached herewith my fla file for reference. script as below,
mcMain.stop();
var leftArrow:Boolean = false;
var rightArrow:Boolean = false;
var downArrow:Boolean = false;
[Code]......
View 1 Replies
Feb 21, 2011
Flash CS4 - AS3
I'm creating a small flash movie into which i'm loading in seperate swf files. All of the external swf files load into a movie clip called pageContainer_mc when their relevant button is clicked.
When testing the movie and clicking the buttons to load in the different swf files, it becomes slugish after a while. Would it help if i unloaded the previous swf file before loading the new one. If so, how would i achieve this.
This is how i am loading in the swf files:
Code: Select allshowsText_mc.addEventListener(MouseEvent.CLICK, gotoShows);
function gotoShows(e:MouseEvent):void
{
var myLoader:Loader = new Loader();
pageContainer_mc.addChild(myLoader);
[Code].....
View 3 Replies
Jan 20, 2010
I have a movie wherein on the stage I have a empty MC with the instance name of mainImage.
There is a menu with listeners that load in different swfs externally into this 'mainImage' clip. The problem I discovered is that I cant seem to unload the old swfs upon the loading of a new one.[code]...
View 2 Replies
Jan 17, 2011
I am migrating to AS 3.0 from AS 2.0 and I am unable to unload a loaded movie self.In AS 2.0 i simply used "unloadMovie(this);" have also tried "removeChild(this);" but it doesn't work.
View 1 Replies
Nov 16, 2008
I am loading 5 external swf's into 5 different "buttons".Right now they all load, but they load on top of each other.
View 2 Replies
Mar 22, 2009
I was finally able to work out a way to attach and preload external SWF files - now I am on the hunt to understand how to unload the external SWF file on a mouse event so that a new SWF file can be played.
View 20 Replies
Mar 7, 2008
I have a main SWF (=Homepage) which displays contents that are external SWFs. Now I have figured out how to load external SWF in my Homepage (when you click a button - see code below), but I don't know how to unload them according to my needs... See, I have a "close button" in every external SWF and with AS3, I'm a little lost on how I should proceed to make this button unload the external SWF displayed on the Homepage...
[Code]....
View 9 Replies
Jul 29, 2008
I'm creating my portfolio in Flash CS3. I have five buttons in website.swf. I also have five external swf files.If you click a button, it loads an external swf. If you click another button, it unloads the first swf and loads the next one. Is there anyway to unload it and load the next?
stop();
function loadMain(e:MouseEvent):void{
var loadMain:Loader = new Loader();
[code]....
View 14 Replies
May 16, 2010
I use this code on external swf's (launched from Home swf). Home swf is already playing in the background...so maybe I don't even need a "get URL", maybe I need to just bring to front (and play from certain frame)?
this code works to get Home swf but I think the child swf is still running in the background? How can I A:unload the swf this button is in when this button's clicked OR B: just unload this swf without reloading home swf.
[Code]...
View 0 Replies
Nov 30, 2010
im using the [code]function to load files into my fla .im trying to put a button in each of the loaded swf files that will tell the main fla to unload the swf and gotoAndStop(1)i have 3 buttons on the first frame of main fla. the first button has [code] different game.so i need a button to unload the game and gotoAndPlay(1) i know how to do this in as3 but im not to familiar with as2.
View 1 Replies
Mar 15, 2011
Everything works perfect except for one problem I just can't figure out. On the homepage, called "home_page_swf", I have three buttons at the end of three paragraphs that say "Learn More" and need them to trigger the "home_page_swf" to unload itself and replace it with one of the other external swf pages. I basically want the three buttons within the "home_page_swf" to perform the same function as the "Services", "Portfolio", and "Team" buttons that are located in main swf. I've been trying to read up on it and I keep finding something about "Dispatch Even" but can't figure out how to apply it to the code I am using for the website I'm working on. I'll post the code below for the main navigation swf and what the labels are for the buttons that are inside the external swf called "home_page_swf".
Main SWF with main navigation buttons:
var Xpos:Number = 0.0;
var Ypos:Number = 0.0;
[code]....
View 1 Replies
Oct 7, 2009
I have this simple code to play and stop external swf[code]...
View 6 Replies
Oct 28, 2009
OK this should be the last of the coding to complete my AS2 to AS3 conversion of a site. The AS2 site had an external photogallery .swf that loaded from a navigation button on the main timeline. It used the loadMovie function so it loaded a photogallery on top of the main .swf in level one.
I also had unloadMovie,1 in all the navigation buttons so if a user was in the gallery and they clicked anywhere else in the main .swf which is all in level 0 the gallery in level 1 would be deleted.
In this situation the gallery that will be loaded on top of the main.swf needs to be a little smaller than the main ,swf so the navigation on the top of the main shows through. If the main.swf is 900 x 600 I would need to load the photogallery on top which would be 900 x 450 and need to use x and y coordinates so when the swf loads it loads in the right spot.
View 1 Replies
Apr 17, 2010
I loaded an external SWF file, now I need to understand how to unload the external SWF file. Is it possible to add the code to the last frame of the external SWFs internal timeline, so when it exits the last frame, it unloads itself.The script to load the SWF is below. Can I add the unload code to the last frame of timeline of the SWF?[code]
View 3 Replies
Jun 17, 2010
I've mp3, eksternally loaded and I controlled from main time...the bugs are1. If I wanna go to another .swf file, i still can hear the sound...2. if I click the button wich linked to mp3.swf, the sound/song are duplicated by2, and then if I click again the sound are duplicated by3...how I can fix this problem??? oia, the buttons to call another swf are only in main swf, and here is the code://zhe button
var Xpos:Number = 140;
var Ypos:Number =100;
var swf:MovieClip;
var loader:Loader = new Loader();[code].................
View 6 Replies
Oct 12, 2010
All of my buttons load their respective external swf files. However, they load on top of each other. How do I set each button to UNLOAD the external swf's that have already been loaded by the previous buttons.Here is what I have now:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);
var fl_Loader:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;
[code]......
View 2 Replies
Nov 11, 2009
I am building an on-line game for autistic children, and I am facing a problem where I load a SWF to play a mini game. Although when the mini game is over I want to go back to the original SWF (and a different scene to which I left.)
I use:
var request:URLRequest = new URLRequest("hidenseek.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
stop();
To load the swf, although I can't figure out how to unload it on a frame, and then on top of that take it back to original SWF to a new menu?
A work around could be to just have the new menu in the loaded SWF? Could I unload the original SWF or do I have to always keep it open?
View 9 Replies
Dec 8, 2009
i'm making a flash website with AS3, so we have index.swf and about.swf
index.swf
|'~> main.as // here is all my script attached to index.swf
'~> in a folder / about.swf
Now i load my about.swf in index.swf with no problems, i need to make a close button in about.swf to unload it from index.swf,
here is my code:
Main.as =
ActionScript Code:
package org.FlepStudio{
import flash.display.*;
import flash.events.*;
[Code].....
View 1 Replies
Jan 13, 2012
I have a Flash project where I need to load and unload external SWF' files. I have it working, but it seems that after the second time it attempts to unload and load, it has strange results. have 4 SWF's. The Main.swf and the other external 3 that will need to load. n the main SWF I have create the loader this this code:
[Code].....
This seems to work and load the other two SWF's the second one (M-2_WIB.swf) works fine. It successfully unloads the first SWF, and loads the second. But when it get's to the third, it chokes. It does successfully load that third swf (M-3_HOACS.swf), but once it loads it seems to freeze on the first frame, and no action script continues to work. The strange thing is, if I just run the third SWF (M-3_HOACS.swf) independently, it works fine. SO there is something in the loading that is causing it to freeze. Is this a problem in the way I have the loader scripted, or maybe the way I am using addChild?
View 7 Replies
Jun 22, 2009
I have 3 nav btn and each btn load an external swf successfully. My problems is it doesn't unload. I have tried adding pageLoader.unload(page) and mcContainer.removeChild(pageLoader) but it doesn't work. The code below contains load external swf only.What is the best way of unload a swf using as3?
var mcContainer:MovieClip;
var pageLoader:Loader = new Loader();
galleryBtn.addEventListener(MouseEvent.CLICK, galleryPage);
[code]....
View 2 Replies
Apr 22, 2011
I have been trying to put together a file that has a few buttons that when clicked begins a preloader animation (with the current swf still on stage and visiable) that once the preloader is completed it will play an exit animation of the current swf then plays the intro animation of the selected swf. An example link of exactly how im wanting the swfs/preloader to interact together is here....costumize.me...Im attaching the file I have so far.
View 1 Replies
Nov 25, 2009
I have a button that loads an external movie onto the stage:
Code:
magnalock.addEventListener(MouseEvent.CLICK, magnalock_newvid);
function magnalock_newvid(event:MouseEvent) {
trace("you clicked me");
[Code]....
View 3 Replies