Loading/Unloading a .swf that adds event listeners to the Stage

Hi all,
Disclaimer
Apologies if I suck so bad at using forum search that the answer to this is on page 1 somewhere; I tried...
Question
I am loading and unloading a .swf to which I do not have source code access. This .swf places several event listeners on the stage, as far as I can tell. When the .swf is unloaded, the event listeners placed upon the stage still seem to be in effect. Using unloadAndStop doesn't seem to do it, and I have to target Flash Player 9, anyway, so can't really use it. Is there any other way I can keep this external .swf from holding onto my main movie's stage?
Additional info
All eventListeners and references being set by my code are removed.
I've managed a little contact with the author of the .swf:
I've requested he provide a dispose() method I can call to get all the listeners removed, and send an updated .swf.
He's suggested that I should be able to avoid the problem by loading into a unique ApplicationDomain. I'm not terribly familiar with this, but have given it a try without much success. Is this a valid solution - can I really protect my 'stage' by properly using ApplicationDomains - or do I need to persist in trying to get a public dispose() method built in?
Thanks in advance!
Cheers, John

thanks for reply sir
sir actually, i have not any problem with loading any file but i need to go back to intro.swf file when i click on clsbtn of main.swf, i want unload the main.swf file and panel.swf file
actually i did was, i have intro.swf file and there is button by clicking load main.swf file (where is timeline controling butons) and in the main file automatically load panel.swf file ( where is all animation)
its all play gud , no problem
but my problem is there is a clsbtn in main.swf file and when i click on that button everything should be unload and it should return on the previous position in intro.swf
i hope u understand what i am trying to say

Similar Messages

  • Add event listeners to dynamically loaded symbols?

    Hi,
    I'm trying to dynamically load different MovieClips based on user input. Several of those clips have embedded url link symbols. How can I add event listeners to the url links if the dynamically loaded MovieClip does not have an instance name? Seems like I can (right?) apply an instance name when the clip is loading, but the event listener doesn't compile because the name is not there yet, so that seems out.
    Am I on right track?

    Are you saying that you will instnatiate this symbol several times and each time url for this link is going to be different?
    There are at list two ways to deal with it.
    1. Inside symbol you can dispatch a custom event once it is clicked:
    myLink.addeventListener(MouseEvent.CLICK, onClick);
    function onClick(e:MouseEvent):void {
         dispatchEvent(new Event("linkClick"));
    Wherever you instantiate the symbol (perhaps on timeline):
    var symbolInstance:MySymbol = new MySymbol();
    symbolInstance.addEventListener("linkClick", onLinkClick);
    function onLinkClick(e:Event):void {
         // do whatever
    Second way would be to pass url value into symbol instance itself and deal with with it on a symbol level. I personally prefere way 1.

  • Loading an external swf that loads an object from url

    i am trying to load an external swf that in turn automatically loads an object. i want the external swf to only be loaded once the object is loaded in it. right now it loads the external swf first and then the external swf loads the object specified at a url...

    thanks kglad. i think i need to try and load the external swf, wait for it to load its object, and then display it... will look into it and get back...

  • Dynamically loaded swf to communicate with MovieClip on the stage

    I have a heck of time here with an issue. I have an xml document that when a certain button on the stage is clicked it loads it's corresponding external swf into an empty movieclip on the stage. This empty movie clip is a holder for all external swfs.
    So what I'm trying to do is when an external swf is loaded that has buttons on it, I need those buttons to communicate with the main timeline and remove a mc that is on the Stage. I need the currently loaded swf(s) to be able to do this. So whatever the currently loaded external swf is that's loaded, I need it to talk to the main timeline. (I have quite a few external swfs that need to do this) So I imagine I need to somehow target the currently loaded external swf to get it to talk to the main timeline.
    The code below in summary doesn't work but it doesn't give errors either. I don't pretend to know what I'm doing and I haven't been successful in searching for a solution to this particular issue. If someone could give me guidance or direct me to a solution. I'd so much appreciate it.
    // main timeline object
    var index:Object=this;
    function loadComplete (e:Event) {
            TweenMax.to(index.mcholder,1, {alpha: .5});
    // add the current module to the mcholder movieclip by using addChild
            index.mcholder.addChild(e.currentTarget.content);
           (e.currentTarget.content as MovieClip).addEventListener("eventTriggered", startListener);
    function startListener(e:Event):void {
    var ext_swf:MovieClip;
    ext_swf = e.currentTarget.content as MovieClip;
    trace("external swf");
    ext_swf.button1.addEventListener(MouseEvent.CLICK, talktomainswf);
    function talktomainswf():void {
    TweenMax.to(index.mc_thatsonthestage, 1, {x:1000});
    // now we have the first load we set firstLoad to false
            index.firstLoad = false;
        function loadError (e:Event) {
            trace("error");

    You can use the event dispatcher to communicate between external swfs and a main timeline,
    like so:
    //in an external swf
    //Once loaded
    function onLoadComplete(event:Event):void
         //dispatch an event in the form of a string
         dispatchEvent(new Event("Talk to Main Timeline")); 
    //On the Main timeline
    //listen for "Talk to Main Timeline"
    stage.addEventListener("Talk to Main Timeline", listenForCallsFromExternalFiles, true);
    //if the event is heard, do this:
    function listenForCallsFromExternalFiles(e:Event):void
         trace("I heard ya, now do stuff...");
    That's the basic idea anyways, I use it all the time.
    hope that helps,
    ~chipleh

  • Are there any specific files (other than swf) that are not supported in the content viewer?

    Are there any specific files (other than swf) that are not supported in the content viewer?

    Specifically -- Is there a limitation as to any content in a PDF that would keep it from displaying correctly other than swf?

  • How to Load/Unload external SWF

    Hey all, I'm in a desperate struggle to meet a deadline for college coursework. I am unable to UNLOAD an external SWF file that I have put inside another SWF file. The problem that is occurring is, although it loads successfully, when I attempt to navigate to another page after viewing the external SWF, I expect it to close as it goes on to another page however, it remains in place. If i then go back on to the page that it is loading from, it will start to keep adding more and more SWF's. The print screens should explain it easier... Below i'll post the code that I'm using currently. The external SWF I am trying to load/unload is an interactive hangman game (whether it being interactive has an effect I do not know), but any and all help with this would be seriously appreciated!
    The code currently being used is:
    var _swfLoader:Loader;
    var _swfContent:MovieClip;
    loadSWF("Real Hangman.swf");
    function loadSWF(path:String):void {
       var _req:URLRequest = new URLRequest();
       _req.url = path;
       _swfLoader = new Loader();
       setupListeners(_swfLoader.contentLoaderInfo);
       _swfLoader.load(_req);
    function setupListeners(dispatcher:IEventDispatcher):void {
       dispatcher.addEventListener(Event.COMPLETE, addSWF);
       dispatcher.addEventListener(ProgressEvent.PROGRESS, preloadSWF);
    function preloadSWF(event:ProgressEvent):void {
       var _perc:int = (event.bytesLoaded / event.bytesTotal) * 100;
       // swfPreloader.percentTF.text = _perc + "%";
    function addSWF(event:Event):void {
       event.target.removeEventListener(Event.COMPLETE, addSWF);
       event.target.removeEventListener(ProgressEvent.PROGRESS, preloadSWF);
       _swfContent = event.target.content;
       _swfContent.addEventListener("close", unloadSWF);
       addChild(_swfContent);
    function unloadSWF(event:Event):void {
       _swfLoader.unloadAndStop();
    removeChild(_swfContent);
       _swfContent = null;
    This printscreen is showing what it looks like in the Flash view (plain background and external SWF loads when this SWF is published)
    What it looks like when loaded as published swf
    Picture of the external SWF working inside the other SWF
    Picture of it not being able to unload when i navigate to another page!
    Finally, a picture of it doubling up when i proceed to go on the 'game' page again, it just keeps loading the SWF's rather than unloading them!

    for example, file1 consits of two buttons, and also considered as main page. As i click on these two buttons , it will lead me go to open the external file2.swf, and file3.swf respectively. (file2.swf and file3.swf could have other navigation buttons, however, i am just simplify here).
    the code you provided is working fine. but i want to totally remove/unlink the orginal file (file1.swf) when i click on either buttons which could lead me to other page (file1.swf or file2.swf).
    Besides that, in file2.swf and file3.swf could have another "back" button to turn it back to the main page (file1.swf). When the user click on that back button, the file2.swf will unloaded...and file1.swf will be called back again...
    can it  be done?
    so sorry if my poor explanation makes you confuse..
    thank you.

  • Load/ Unload external .swf

    ----------------------------------------
    vita | web | design | illustration
    "main" here
    I try to have external .swf on this "main" part of my flash
    design automatically using load actionscript.
    I have 3 different sets of actionscripts for load/unload.
    But, the problem is when I click vita or other menu on the
    top after loading "main" external .swf, they are overlapped.
    How can I unload the external .swf from the automatically
    loaded .swf?
    (As I know, there are mostly buttons to click on loading
    external .swf. But for my design, I want it loads automatically.)
    Thanks in advance for suggestions. Please let me know if my
    description/question is not clear to answer.

    Are you using AS2 or AS3. The approach is completely
    different for both.

  • Remove Event Listeners (at the right time)

    I have a app which loads multiple flv's, I also have a timer
    (digial) which shows how long the movie has been played for. The
    problem is that whenever i load and new move (through the same
    "loadVideos()" function, the timer variables ("lagTime", "endTime")
    are not reset (even though the correct variables are being passed.
    I believe it has something to do with the event listeners which are
    being used to load the movies. How can i clear all the listerner
    before reloading the movies?
    Here is a code snippet:
    Thanks in advance

    Thanks, kglad
    Yes it traces 'endTime' but what happens is that when i play
    the first movie is will display for example ("40,40,40,40" etc...)
    until the video stops playing. If i load another movie it will then
    trace ("40, 20, 40, 20, 40" etc...) so i need to kill the
    listereners and reload the variables.
    Jake

  • Is loading a as2 swf into my as3 flash site the problem here?

    My question is listed on another board here, but I am too inexperienced to understand how to fix my issue:
    http://forums.adobe.com/message/5045059#5045059
    I went on flashkit.com and a member there immediately said that it "sounds like the problem is using the AS2 swf loaded into the AS3 swf."
    If it is... this mean I will have to convert everything in the AS2 .swf (including the XML retrieval script) to AS3. I may need some help with that if that is the problem.
    So will AS2 swfs cause XML communication and retrieval issues if loaded with a loader script into an AS3 file?
    Everything works (the buttons are clickable and when you click on a square in the "thumbnails" scroller it displays the correct photo title and captions), except I just cannot see the actual photos in my XML gallery. I am truly clueless as to why this happens and I've searched for days straight and tried many things...
    You'll find all the details of my problem in the above link.
    Thanks!

    Its really not worth the trouble to get as2 working with as3 if your goal is to make an xml driven gallery. There are literally thousands of free examples/tutorials how to achieve that feature with 50+ LOC. Like this one.

  • Add Event Listener for the deletion

    How can we add an event listner on the deletion of an item in the document?

    As far as I know, InDesign DOM doesn't have such event, but Rorohiko's Active Page Item Developer (APID) Toolkit has it:
    subjectDelete — Sent when one of the observed page items is about to be deleted.

  • Is there an app that adds medical terms to the built in dictionary?

    We use the iPad at work and it would be helpful for things like medications and medical terms if there was an APP that added common ones to the built in dictionary. Thanks for the imput

    One of my most favorite apps, Drafts, has arrows on its on screen keypad. Drafts has been my go to app for any text entry for about a year. The interface is beautiful, it syncs with the iPhone version and, from the app it only takes a couple of taps to move whatever you've typed to whatever app you want to use it in. Another big plus is that it supports TextExpander.
    Best of luck.

  • How to add actions only when the stage playhead passes a label/certain time?

    I have an animation that is 2 seconds long. On the 1 sec mark there is sym.stop(); and a label called 'in'. At the 2 sec mark there is another sym.stop();
    So what I want to happen is for the animation to play up until 'in', then on mouseenter for the stage have sym.play();, and on mouseleave sym.playReverse();. This will make it so that only the second half of the animation will get played on mouseenter/leave.
    My problem is that the mouseenter/leave also gets applied to the first half of the animation, not allowing the second half to animate if the user mouses over during the first half. I know this requires an if statement but I don't know how to write it. So it would be something like this: if the playhead reaches 'in', apply mouseenter/leave actions.

    yes, I am. By the way I've found the solution. Someone might find this usefull.
    In design.xml having
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput"/>
    use this
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput">
            <defaultAttribute name="text" value="ExtendedTextInput"/>
        </component>
    so when adding this component to design view, it will have text setted to value ('ExtendedTextInput' in this case).

  • Urgent: How to add event listeners to a null object?

    I have an object that is lazy loaded, and therefore starts out null.
    How can I add an event listener onto this null object, so that it fires whenever the object is instantiated?
    WHY does arrayCollection.addEventListener(CollectionEvent.COLLECTION_CHANGED, function) not work??
    Thanks!
    C

    C,
    the answer to your question "WHY does arrayCollection.addEventListener(CollectionEvent.COLLECTION_CHANGED, function) not work??" is that addEventListener is not a static method, ie it has to be attached to an actual instance. I agree that in your situation it would be handy to have it as static, something like ArrayCollection.addEventListener(etc) but I'm not at all sure that is a good plan in general, as usually we want events to fire from an actual instance of the class, not generically. A quick look through the adobe docs has convinced me there are not many static methods at all, and none that appear to help you.
    I take it from your description that you don't know exactly when the collection is instantiated? But presumably though you do have a point where new is called? Or something equivalent like populating it from something else?
    Richard

  • My add event button on the calendar is greyed out on my ipad mini with iOS 7 how do I fix this?

    I just downloaded iOS 7 onto my ipad mini and went to add an event in my calendar but the plus button is greyed out and I can't click it. Any suggestions. Thanks.

    I had the same problem until this moring. Using Google, go to the black bar (+you, search, images, more) and hit +you. That should activate the Plus key. Hope it works with your ipad, too.

  • How can I insert a button in my form that add a copy of the page where I'm in? It is possible?

    Hi! I'm doing a cv template for my company so that Human Resourses can send to candidates. I made the form and I have  a page for the "professional experience" area. This page is enough for a recent graduated student but not for a senior candidate (that has more experience). Can I insert a "ADD" button on this page where it creates a reset copy of the "professional experience" page where the candidate could add more professional experience? Thanks

    Yes, by using JavaScript to create a new page by spawning a template page. The downside is that is will only work with Reader 11 (and Acrobat) and not previous versions of Reader. It also won't work if you need to Reader-enable the document so that pre-11 versions of Reader can save the filled-in form. If these limitations are not a problem and you need more help, post again.

Maybe you are looking for