ActionScript 3.0 :: Loading And Unloading External Swfs When User Clicks Buttons?
Jan 9, 2012
I am working on a few websites at the moment, one of the being my online portfolio, as well as my website for a sleep product I am trying to sell. I have very little experience with AS3, last time I created a website AS2 was used. I've tried a few online tutorials, but nothing gets the job done, there is always some error..I have a index.swf which loads the default home.swf.There is also an about.swf, contact.swf, order.swf, and All I need is for the external swf to pull up when the corresponding button is clicked, and when the next button is clicked, for the current swf to unload and the new swf to load. This was so simple with AS2, one would think things might be as simple if not easier.
View 9 Replies
Similar Posts:
May 29, 2009
I have a question regarding the swapping out of swf files in Flash CS3 / AS3.I start my project with a �logo� swf, which has no interactivity.At the last frame, the following code is used to load another swf from the local folder:
-------------------------------------------
//Stop current swf and stop its sound
stop();
SoundMixer.stopAll();
[code]...
How do I remove and/or unload the previous swf when a new one is loaded? and remove that previous swf from memory? Can I give the current swf access to the previous one, then run a �remove� or �unload� function on it?
View 3 Replies
Feb 17, 2011
After years of putting it off, I've finally begun the move to AS3.The frustration I've encountered is evidently shared by a lot of other designer/developers. Knowing that the future is inevitable, I have bitten the bullet and forged ahead. There has been one thing, however, that has just been a real quandry and has cost me hours of banging my head against the wall.That would be getting an externally loaded swf to (really) unload in an AS3 file.Before I even begin to post code, let me just say that I've tried a lot of things read in books, posts from this and other forums, and trial and error to no real avail. In my research I've come across many others who are experiencing the same problem and even one reference that suggests you not use AS3.For a project that uses multiple loads and unloads that's due in a month, should I just go with AS2?I'm using CS4 on a PC publishing to Flash player 10. And yes I have tried "unloadAndStop()" and "removeChild()".
View 8 Replies
Dec 28, 2008
I am making a website that will have many levels of externally loaded swfs.
1. How do you load and unload the externally called swfs with either an animation within the swf movie, or through the AS when you call it.
2. I will have my navigation loaded on a top level and everything else loaded below. When I click on another Button from my navigation that will load another swf movie- How do I unload the swf that is previously there?
View 3 Replies
Aug 25, 2010
Working on a project that has a main stage and loads/unloads external swfs into it. Most of these external swfs also contain FLVs (that are also loaded externally via FLVPlayback). Basically the user clicks on a button in the navigation and it should unload the swf and FLV that is currently playing and then load the new one. Then after the the FLV and swf play theres a "close" button that they can click to go back to the "home" swf which would be hidden underneath. I got it to work to an extent - but the FLV (even though not visually there) still has its audio playing in the background..
View 3 Replies
Jun 23, 2011
I am creating an interactive slideshow, like a PowerPoint effect, I have a main scene, 4 Buttons, a Home Button, Play Button, Forward Button & Back Button.I want the Home Button to take me back to the start of the scene, Forward Button to Load a External swf slide and when the Forward Button is clicked again to Unload External swf and load in the next swf slide, I also want the Back Button to do a similar thing!I keep getting External Swf pile-ups or flickering
Here's my code:
[CODE]
Play_button1.addEventListener(MouseEvent.CLICK, Play_btn1);
[code]........
View 3 Replies
Jul 9, 2005
when loading/unloading external swfs into a container movie,i`ve noticed that any intervals (within the loaded files)i`ve used are not being cleared despite the movie being unloaded causing errors when the same swf is reloaded. Without manually clearing all intervals is there a way round this?
View 1 Replies
Feb 23, 2011
I spent almost a week trying to figure out how to unload a currently loaded swf using its button and loading a new swf... I have three files, a main.fla, file1.fla and file2.fla. In my main.fla, I have a code which loads the other two files. If i will click the "unload" button in the file1.swf, I would like the main.fla to unload the file1.swf and load the other file, file2.swf. Here is the code to load the file1.swf:
[Code]....
View 1 Replies
Sep 11, 2009
I have a main fla file which loads an external swf into an empty movieclip on the main timeline which works fine but I want a button in the external swf to load another external swf into another empty movie clip on the main timeline.eg. start.swf loads UKEIAMap.swf into (empty movie clip within start.swf) MapLoader_mc then a button havant_b within UKEIAMap.swf needs to load HavantProjectSheet.swf into (empty movie clip within start.swf) ProjectSheetLoader_mc without unloading UKEIAMap.swf
View 3 Replies
Jun 30, 2010
I have 7 buttons on my main page, on the left side of the screen. I want the buttons to load the external swf on the right, and then unload when a different button is pressed. Do I need to make an array? Do I need an empty movie clip to load each swf into?
[Code]...
View 20 Replies
Aug 17, 2009
Flash CS4 Actionscript 2.0 internal training project Main movie is a single frame project, containing just the interface. This includes a menu listing 80+ individual "chapters" for the training series. Each "chapter" that loads is its own project/swf of varying lengths. Once the main interface loads, it should automatically begin to play the chapters sequentially without the user selecting anything from the menu. When one chapter finishes, the next should load. If the user DOES select a chapter in the menu, it should load that SWF, and continue auto-playing from that selection forward.
- Each chapter swf has a built-in play/rewind/ff bar, various movie clips with animations, dialogue audio track and a fairly lengthy embedded FLV movie, and therefore a preloader before each chapter is mandatory.What I have so far works, but it's embarrassingly crafted my lack of AS skills:- First frame of main interface movie (let's call this main.fla) contains the following code:
var slideName = "modules/00.swf";
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(this);
[code]....
View 0 Replies
Jun 4, 2006
I basically made movie clip buttons to navigate through my site, has sounds and all...now all i need those buttons to do is to call out a .swf file from a certain directory. I know how to do this with the traditional button, but not with a movie clip button since it requires a function. This is what I have tried and failed with so far:
// PROFILE SECTION BUTTON //
this.profile_mc.onRollOver = function(){
profile_mc.gotoAndPlay("_over");
[code]....
View 3 Replies
Aug 7, 2008
I just don't know how to target it. I'm trying to load an external swf, when releasing a button. The problem is the button is not on the main timeline, but instead nested in a movie clip. I just don't know how to target that button. I tried loading the swf with a button on my main timeline and it worked, so I know the problem is not with the movie clip loader class or the actual swf itself. I actually learned this from a note midway down the page in one of your tutorials..... [URL] how can i target that button that is nested in that movie clip?
[Code]...
View 2 Replies
Jul 2, 2009
I'm trying to create a site which loads external SWFs into a Moviefor its content, and the entire site is contained in a Movie Clip located on the main timeline.
I keep getting a 1009 error, so I'm assuming that AS isn't drawing the loader where I want it to be, so I'm fairly certain I'm doing something wrong..haha.
Here's a link to my Files: [URL]
View 2 Replies
Apr 23, 2010
I am creating a course that requires loading/unloading of several swfs in a container. My course structure is something like :
Course->Module01->src->test.as
->Module02->src->test.as
When I load file from Module01 in my container it works fine, but files from Module02 is not working as they should. They seem to be reading the code from the as file in Module01. The course works fine when I give the as files different names, but I want to keep the names as they are now as I have created several modules and sub-modules on similar structure.
View 3 Replies
Jul 21, 2005
What I want to achieve is active links like in HTML websites.I have 3 buttons on the stage, when the user clicks on the first button it should be highlighted and should remain in that position till the user clicks on the next button. When he clicks on the 2nd button the previous one should come in normal state and the 2nd one should become highlighted and so on....
View 3 Replies
Nov 11, 2004
could someone with scripting a fadein/fadeout transition for external swfs between the button clicks or suggest another way to do it?
View 1 Replies
Nov 5, 2009
I've made a flex 3 app that is sitting on my web server. People will be able to link to this flex app on my web server on their own sites/blogs/forums and so on. Is there any way I can log where a user that clicks on it comes from? Example: the URL to the flex app is [URL] User A links the flex app at his blog at [URL] Then User B comes in to User A's blog and clicks the flex app and finally ends up at my site. Any way I can log User B's click through the flex app?
View 2 Replies
Nov 2, 2010
I used to do this fine with AS2 and now i'm struggling to get it to work in AS3.my code is as follows:
PW1.addEventListener( MouseEvent.CLICK,loader1 );
//==================== PS function =============================================
var ldr:Loader = new Loader();
[code].....
View 3 Replies
Dec 12, 2011
loading a SWF file and then removing it with the use of buttons. It's a fairly simple situation, but I just can't seem to get it to work.
Here is the code:
function newvid(event:MouseEvent){
var tv_loader:Loader = new Loader();
tv_loader.load(new URLRequest("tv.swf"));
addChild(tv_loader);
[Code]....
The scene basically says click on button and tv turns on...but I can't seem to get the off button to work. I think I am missing a step some where in the code.
View 5 Replies
Apr 1, 2010
I'm trying to load an external swf and unload it after its completion. I have tried a few things and am stuck. Here is my current code to loading the swf, which seems to be working fine, its the unload I cant get:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad() {
[Code] .....
View 3 Replies
Nov 29, 2010
I have a external swf that has an embedded video that loads automatically. Once it loads I have a button that unloads it and reloads. The first time I unload it, it works fine. The second time the video unloads but the sound continues? This happens each time I load and unload; the sound continues to loop.
stage.scaleMode = "noScale";
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs1/ME_video1a1.swf");
[Code]....
View 4 Replies
Nov 13, 2008
I am slowly learning AS3 but have hit a bit of a brick wall though I am sure it is something that many will see as easily resolvable, just my lack of knowledge and understanding of AS3 at this moment.
My query is I am trying to create a SWF which loads in (3) external SWF's using three movieclips I have within the main SWF. I have managed to get the external SWF's (1.swf, 2.swf, 3.swf) to load in when each of the movieclips / AS3 buttons have been clicked but I cannot figure out how to unload the current selected SWF file (e.g. have initially click on btnOne which displays 1.swf yet when click on btnThree to display 3.swf, 1.swf has not been removed from the stage and overlaps 3.swf) when I want to load another SWF file (sorry if this does not make sense). Below is the test code I have tried:
Code: Select all/////////////////////
///////Loaders///////
/////////////////////
//One
[code]....
My question is how do I unload (or removeChild I guess) the current SWF from the stage when I click on another movieclip / AS3 button to load another external SWF without the mish-mash as can be seen in the uploaded test files?
View 14 Replies
Aug 4, 2004
I am Using Flash MX ActionScript.
Anyways i have a series of buttons, and I would like them to each load a external SWF file into a movieclip. I have accomplished this so far but, I would like it so that whenever I click a button it unloads any already loaded SWF file that is already there. This is what I Have So far
on (release) {
loadMovie("movie.swf", this.movieholder);
}
View 3 Replies
Dec 8, 2008
I am loading an external swf file into my main swf movie with a button. But I donot know how to unload it. Here are the scripts.
on (release) {loadMovie("Main content.swf","Main1");
}
Main1 = the holder on the stage
View 2 Replies
Sep 20, 2009
I am studying AS3 by myself, It's all about loading and unloading external swf's. My code is working perfectly though I just have some questions about load and unload issues. I have three buttons on the stage and it should load its external SWF
[Code]...
Each of the button should load it's external SWF's intro when click. My problem is that I don't know how to command the button to play the swf's outro and then load the next swf everytime I click a button Example: When I click homeButton_btn, the external swf should load "home.swf" and then if I am going to click page1Button_btn, the outro of "home.swf' should play and then once it reaches the end of it's timeline, it should load "page1.swf". Same goes with page2Button_btn, whatever swf that is on the stage should play it's outro first and then load "page2.swf" My questions are:
1. How can I control the external SWF to play it's outro and then load the next SWF.
2. What code should I put at the end of the external SWF's timeline.
3. Where do you think I should put the preloader? Is it better to put it at the external swf timeline? or on my main swf timeline?
4. Does load and unload of external swf also work with movieclips? Like for example I will not use a external swfs, instead I will use movieclips to load and unload its content.My Actionscript 3.0 code
[Code]...
View 1 Replies
Aug 4, 2004
I have a question, I'm new so i dont know much ^_^ I am Using Flash MX ActionScript. Anyways i have a series of buttons, and I would like them to each load a external SWF file into a movieclip. I have accomplished this so far but, I would like it so that whenever I click a button it unloads any already loaded SWF file that is already there.
This is what I Have So far
[Code]....
View 3 Replies
Jun 19, 2009
From my main file I'm loading an external swf file. This file overlaps the original file so I began looking for a way to unload the original file. I've not been too successful. Right now, I've created a background layer which allows the loaded file to cover the original file without bleed through. I'd rather have the original file unload before the newly called file is loaded.
Here's the code I've found so far:
//Declare Variablesvar Xpos = 0;
var Ypos = 0;
var loader:Loader = new Loader();
var swfFileToLoad:URLRequest = new URLRequest("holdHumans.swf");
//Go to CreationremoveChild(loader);
loader.load(swfFileToLoad);
loader.x = Xpos;
loader.y = Ypos;addChild(loader);
This code is normally associated with a button event but I have to be able to use it from within a timer function in the original file. When the function is called, I get this message:
Error #2025: The supplied DisplayObject must be a child of the caller.
I get this message too when I try using it from the externally loaded swf file.
View 20 Replies
Sep 13, 2011
I'm trying to create a pretty simple site using a couple of different external swfs loaded into a main swf.
At the moment, in the timeline, I have the following code in frame 1 on the actions layer:
import flash.events.MouseEvent;
stop();
navbutt.addEventListener(MouseEvent.CLICK, shownavbg);function shownavbg (myEvent:MouseEvent):void { gotoAndPlay (10);}home_btn.addEventListener(MouseEvent.CLICK, showhome);function showhome (myEvent:MouseEvent):void { gotoAndPlay
[code]....
At the moment, the Main.swf loads perfectly and works fine. But when I click the gallery button, it jumps to frame 76, and plays the Main.swf. It doesn't load the ZenGalleryDemo.swf file.....
View 1 Replies
Jul 10, 2010
I am trying to load external swf files for each page of my website. I load the home right off the bat, then when I click on a different page, the content only loads on top of the previous loaded swf without getting rid of the previous page. I could be doing it wrong, but I use unload and removeChild before reloading the new page in the button function and it still stays on the stage.I could go back into my external swf files and add a white background underneath the content in order to mask out the swf that stays behind. But even if I do that it still would be loading multiple copies of each swf gradually slowing the whole site down.
View 1 Replies