ActionScript 2.0 :: Unloading An External Swf Using The MovieClipLoader Object?
Jun 6, 2007
I"m having a tiny problem with unloading an external swf using the MovieClipLoader object. This is what I"m doing:
Code:
if (mcLoader.unloadClip(container)) {
trace(container.testVar) // shows testVar
}
button.clickHandler = function () {
trace(container.testVar) // says undefined when clicked
}
So what's happening is right after I call unloadClip it's still loaded however if I click the button at some point after unloadClip is called it shows that is has been unloaded. So obviously there's a little bit of a delay while things are being unloaded. My question is, does anyone know of a way to detect when the clip is unloaded like with an event listener or something? I want to be able to load up another swf after one is unloaded for the level maps for my game I'm working on.
View 2 Replies
Similar Posts:
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
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
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
Aug 10, 2004
This is going to be related to the oop post.For whatever reason, I can't seem to call myMovieClipLoader.(url,target) to load a MovieClip from within a method of a custom class. It works fine when I call it in the timeline.
View 4 Replies
Mar 26, 2009
I'm in a hurry and need big help quick
1 - I'm using AS2 and know my way around it well
2 - I'm loading an external SWF using MovieclipLoader
3 - The external SWF has a MP3 file in it's library (exported for actionscript) and is attached to a Sound Object.
4 - Running the SWF by itself, everything is fine, but once it's loaded in my main movie, it won't play, no sound,
View 2 Replies
Jan 28, 2009
I need to do is load an external swf into a movieclip and make sure it stays within a certain size.
1. How do I make it a set size? Instead of it inheriting the root timeline height/widht. ie: my main movie is 900 x 900 the external swf is 700 x 500 and there are mouse moves that rely on the 700 x 500 boundaries.
2. How do I make this: loadMovie("external.swf", "load_mc"); utilize MovieClipLoader?
View 6 Replies
Jan 23, 2007
I am using MovieClipLoader to load a swf. The external swf has about 12 images on it that just show up one after another. But only the first frame displays.
My code:
[AS]
var empty_mc:MovieClip;
var mclListener:Object = new Object();
var myMCL:MovieClipLoader = new MovieClipLoader();
[code]....
View 11 Replies
Mar 23, 2009
I am using the MovieClipLoader class to externally load a .swf file with a preloader. The problem is that my .swf starts playnig behind the preloader, before it is completely loaded...
How can I make it paly only after it is 100% loaded?
Here is what I have so far:
Code:
var loader:MovieClipLoader = new MovieClipLoader();
var loadHandler:Object = new Object();
myGlobalSound = new Sound(this);
[Code]....
View 7 Replies
Feb 6, 2009
I am using the MovieClipLoader object to load a swf into a master swf. I am the using a series of buttons to load various swfs into the master.swf - i.e.; navigation. Her is the code that I am using for the movie clip buttons go to frame 2 of the external swf MM_work is the movie clip that acts as a button. The first three lines of the function give the button its various states and interactivity the final line in the function is telling the movement.swf to load into the master.swf (or level 0) thus booting out the previous movie clip.What I want to be able to do is to fade out the current movie clip loaded into the master.swf (level 0) and once that has been completed to then load in movement.swf. Basically fading out the existing movie clip before loading the next one.
View 3 Replies
Feb 3, 2009
I'm trying to use the MovieClipLoader class to load external swfs into my main movie. A problem occurs when the external swf relies on or loads other external files. The external swf acts as if it's running in the same directory as the main swf and expects files to be located relative to that.
For example:
main_movie/main.swf
other_path/external.swf
[Code]......
This seems to be similar to having the base parameter set improperly in the html, but I haven't been able to find a way to set this when loading an swf dynamically with MovieClipLoader.
View 4 Replies
Feb 9, 2009
ActionScript Code:
var container:MovieClip = createEmptyMovieClip("container", this.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("crossball.swf", container);
function onLoadInit(mc:MovieClip) {
trace(container._width);
trace(container._height);
}
This always traces the width/height of the content of the external crossball.swf file, not its stage dimensions. So let's say crossball.swf has a document size of 200 by 200 pixels and in it is a shape of 115 by 30 it will trace the last as the width/height of 'container'. Is there any way to get the stage dimensions of an externally loaded swf through moviecliploader?
View 9 Replies
Sep 22, 2006
When I load an external SWF into my UI SWF using MovieClipLoader.loadClip(), does the external SWF get cached?
Therefore, if the user tries to reload a SWF that had been previously loaded, the SWF will load from the local HDD instead of the website, right?
In my case, caching of content is important to reduce bandwidth usage.
View 1 Replies
Jan 27, 2009
I'm working on a Flash application that has thumbnails and fullsize versions of an image. The steps I'm taking:
- import the image at runtime, and attach to a movieclip (we'll call it polaroid, since that's what I'm calling it).
- resize polaroid via polaroid._width=3; polarois._height=3; to get my thumb
The image quality is OK for pictures, but it's also fairly important that text not look too pixelated. Is there anything relatively simple (i.e. not too taxing on RAM) I can do here? Even a blurring layer would do the job, if there is any such thing.
View 8 Replies
Aug 25, 2008
I recently built a preloader using the MovieClipLoader object. I used the following events: OnLoadComplete, OnLoadProgress and onLoadStart. I registered my listeners etc and then I decided I wanted to get a bit fancy. So I decided that within the onLoadProgress I would add an"if" statement, this if statement would basically say if the loaded content equals 70 then animate the preloader graphic off the screen using tweening (very simple). The onLoadProgress is continuously called while the content is being loaded but it seems that it does not want to correctly execute my if condition.
Here is the code for the onLoadProgress.
loadListener.onLoadProgress = function (target:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
trace("onLoadProgress");
txtLoaded.text = String (Math.floor (bytesLoaded / bytesTotal * 100)) + "% loaded";
mcProgress._xscale = bytesLoaded / bytesTotal * 100; // address the bar
[Code] .....
View 5 Replies
Sep 16, 2009
My main project loads an external .swf ("room") depending on which button the user clicks. Once that external .swf ("room") is loaded, the viewer chooses a ("demo") .swf to view. I need the "demo" .swf to unload once it is finished playing so that the viewer sees the 1st external .swfs menu again. All .swfs are loaded into an empty loader component. The "demo" swfs were created in captivate thus I don't have access to a timeline for them.[code]That all works fine, but when I load "room" .swfs into the main .swf, the unloadCaptivate(); no longer works.
View 1 Replies
Mar 12, 2009
I'm having a problem unloading an external SWF from my container clip. I've searched all morning for a fix to this problem, with no clear resolution. I thought this was originally a xml update issue, but it's not. A lot of talk about removing child nodes, but I'm not sure what do do there.Here's my code:
PHP Code:
function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; swiff = []; total = xmlNode.childNodes.length; for (i=0;
[code].....
View 1 Replies
Mar 8, 2010
I have a really simple problem regarding the unloading of swf's. I've searched for solutions but somehow I am having some difficulties understanding all the parent-child associations.So, I have main swf that has four buttons, each loading an external swf. The buttons are on the main timeline. The swf's that are loaded have a return button on their main timelines that would need to unload the current swf and thus return to my main swf.
View 1 Replies
Jul 20, 2009
I have a simple file with 2 buttons (load + unload).By pressing the load button, an external movie_player SWF loads (this SWF loads a FLV video into it).The problem is that when I press unload, the movie_player dissapears from the main SWF, but I still can hear it. How can this problem be fixed?
ActionScript Code:
var urlRequest01:URLRequest = new URLRequest("movie_player.swf");
var external_swf01:Loader = new Loader();
[code]....
View 9 Replies
Apr 6, 2011
I'm building a site that has 7 sections. 1 section is a Photo Gallery for which I'm loading an external SWF file that is controlled by an XML file. Im doing this for allowing content editing any time.
All of the other content on the site is one-time, no backend required.
I've successfully loaded the external swf file into a loader in one of the frames. However, when I navigate away to the other 6 sections, I'm unable to unload the external SWF loader. How do I go about this?
Here's my code that loads the external SWF in one frame:
ActionScript Code:
import flash.events.MouseEvent;
//This creates a new instance of the loader object.
var my_Loader:Loader = new Loader();
[Code]....
View 3 Replies
Jan 20, 2004
Is it posible to make a preloader of a SWF that loads an external JPG?
View 1 Replies
May 30, 2010
I'm currently working on a application that displays a webcam picture stream, so what I do is read a image repeatedly from a url and for this I use the loader object, the problem is that when I tested this the browser started to take RAM until it frozen.I used unload() and dispose() but they only hide the image, it still takes memory.This is the image class I made:
ActionScript Code:
package
{
[code].....
View 1 Replies
Mar 31, 2009
I have a main movie menu which has sub movies loaded into levels 1 then section 2 into level 2. I have the subs loading on button but i cant get the subs to unload levels 1 and 2 once they have played.
View 7 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
May 27, 2010
import flash.display.Loader;
stage.focus = myTextBox;
myButton.addEventListener(MouseEvent.CLICK, findTarget);
function findTarget(evt:MouseEvent):void
[code]....
i wanted the loaded image to be removed if the outputBox.text shows ERROR, but i have tried removeChild and they don't work.
View 3 Replies
Jul 20, 2010
having a few problems with my project which i although it work it has some unpleasant bugs that When i load external ´s they show up on top of the Menu button.Maybe because the button i´m pressing is inside the same movieclip as the Menu Explaining better here´s a little diagram of my site:con2 MC (Instance of Menu) ---> cont3 MC (Instance of subMenu) and mainButton MC (Instance of Main)Here´s the general code which is inside the Painel
package import com.greensock.TweenLite; import com.greensock.TweenMax; import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.events.*
[code].....
View 2 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
Oct 3, 2011
In one particular keyframe, I have five buttons on the left hand side of my stage, that when clicked, display an external swf on the right handside. It works perfect fine using the code below. However on this frame where all this is going on, I also have a back button that i want to link back to the home page. But I just CAN'T seem to get it to unload the external swfs as well as go back in the timeline.[code]
View 8 Replies
Oct 28, 2009
I have been able to unload the SWF (emptyMC.removeChildAt(0) ), or so I thought, but if there is sound playing in the loaded SWF it continues to play after the loader with the old SWF is unloaded. I know there is the unloadAndStop() method but I don't know how to incorporate it into my current code.Here is what I have so far. And mind you, eventually there will be 20 pages in the site, let me know:
ActionScript Code:
btnMENU.addEventListener(MouseEvent.CLICK,loadHome);
btnAPPT.addEventListener(MouseEvent.CLICK, loadAbtDoctor);
[code].......
View 2 Replies
Aug 18, 2011
i have a main swf...from the main swf, an external swf is loaded which is a SubMenu.From the Submenu, a SECOND external swf is loaded. I would like a button that closes the SECOND external swf, but the submenu remains.
View 3 Replies