Need help unloading an .swf

I'm using flash CS5, AS3
I'm making a huge module that has a central "Hub" (table of contents) which contains all links to the other slides which are individual .swf files.
The issue is, from the main hub, i click on the link to open a swf and it starts to play.  if the button that returns you to the Hub is pushed before the whole .swf plays through, the symbols and tweens from the swf that was just unloaded, still show up on top of the Hub and keep playing.  anyone know how i can fix this?
code in frame 1 of all swfs:
this.btn_hub.addEventListener(MouseEvent.CLICK, SWFhub);
var fl_Loader:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;
function SWFhub(event:MouseEvent):void
        fl_Loader.unload();
        removeChild(fl_Loader);
        fl_Loader = null;
        fl_Loader = new Loader();
        fl_Loader.load(new URLRequest("Slide HUB.swf"));
        addChild(fl_Loader);
    SoundMixer.stopAll();
any help would be appreciated!
-= Sondax =-

a few issues...  for the code that goes on the loaded swf, the button doesn't return you back to the hub.  i changed the first line to "this.btn_hub.addEventListener(MouseEvent.CLICK,unloadF);", but still doesn't work.  (btn_hub is name of button that returns you to the hub)
for the hub, when i copy and paste the code to add buttons for the other slides, i get errors of duplicate functions:
Scene 1, Layer 'actions', Frame 1, Line 29
1151: A conflict exists with definition fl_Loader in namespace internal.
Scene 1, Layer 'actions', Frame 1, Line 41
1021: Duplicate function definition.
Scene 1, Layer 'actions', Frame 1, Line 45
1021: Duplicate function definition.
line 29 = var fl_Loader:Loader=new Loader();
line 41 = function completeF(e:Event):void{
line 45 = function unloadF(e:Event):void{
the full code in the hub (just 2 buttons added so far):
stop();
this.btn_62.addEventListener(MouseEvent.CLICK, SWF62);
var fl_Loader:Loader=new Loader();
fl_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF) ;
function SWF62(event:MouseEvent):void
if(fl_Loader.content){
unloadF(event);
        fl_Loader.load(new URLRequest("Slide6_2.swf"));
        addChild(fl_Loader);
function completeF(e:Event):void{
MovieClip(fl_Loader.content).addEventListener("unload",unloadF);
function unloadF(e:Event):void{
MovieClip(fl_Loader.content).removeEventListener("unload",unloadF);
fl_Loader.unloadAndStop();
this.btn_11.addEventListener(MouseEvent.CLICK, SWF11);
var fl_Loader:Loader=new Loader();
fl_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF) ;
function SWF11(event:MouseEvent):void
if(fl_Loader.content){
unloadF(event);
        fl_Loader.load(new URLRequest("Slide1_1.swf"));
        addChild(fl_Loader);
function completeF(e:Event):void{
MovieClip(fl_Loader.content).addEventListener("unload",unloadF);
function unloadF(e:Event):void{
MovieClip(fl_Loader.content).removeEventListener("unload",unloadF);
fl_Loader.unloadAndStop();

Similar Messages

  • [Need help with a swf file]

    Hello,
    I need help with a flash demo that I am creating. I have a
    main swf file that contains links to other sub swfs that I have
    created. What I really want this to do is... when I click on one of
    the link on the browser, the other swf have to load in the window.
    I tried to code it with .loadMovie,.... but for some weird reason,
    it is not showing up.
    Can anyone help me on this?
    Thanks

    you might have a security violation and you do have a
    load-target issue. remove that "_parent": there's no 2nd parameter
    in the loadMovie() method.
    if you want to replace the main swf with that url, loading
    into _root is fine. otherwise, you want to use a different
    target.

  • I need help loading a swf file in a flash website

    Hi,
    I am an interactive design student working on a flash portfiolio and need help. I can't figure out how to load a game I made in flash into my porfolio so that it loads after clicking on a button, becomes playable, then have a button to leave the game and go back to my portfolio. I'm working in Actionscript 2.0 because that's all my teachers will show me and I have minimal actionscript knowledge.
    Thanks,
    Emily

    I thought I got it to work with loadMovie, but it only plays the intro, and then either repeats or exits as soon as the first bit of actionscript starts

  • Need help unloading an External .swf within another external .swf

    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.
    I imported a .swf into captivate that will call a function at the end ie..._root.unloadCaptivate();
    and I have the following code in the originally loaded .swf
    function unloadCaptivate() {
    mcLoader.unloadClip(accountingLoader_mc);
    btnEndPeriod_btn.enabled = true;
    btnCashCollect_btn.enabled = true;
    btnFinancialMGMT_btn.enabled = true;
    _root.btnHome_mc._visible = false;
    btnAcct_mc._visible = false;
    btnPlay._visible = false;
    btnPause._visible = false;
    That all works fine, but when I load "room" .swfs into the main .swf, the unloadCaptivate(); no longer works...any ideas? Thanks!

    you should be able to use a loop (like onEnterFrame) to check when your demo swf's _currentframe==_totalframes.

  • Need help creating custom .swf skin and exporting for use

    Please, can anyone help...
    I am currently working on a projects that needs to have a custom flash skin player.
    I have tried copying and editing excisting skins, but when I export the swf and fla into the crrect folders, I am able to select it from the skin list- however it doesn;t show in the player.
    Am I exporting/publishing this in the correct way and to the right folders?
    If anyone can give me a tip of how to achieve this that would be great, or a link to somewhere that may have the infor I'd be happy,
    Cheers
    Cliff

    Hi,
    Do you mean skinning FLVPlayback palyer?
    Warm Regards
    Deepanjan Das
    http://deepanjandas.wordpress.com/

  • Need help to decompile .SWF

    I hope this doesn't break any forum rules, but I desparately need an .SWF decompiled to .FLA. I am the webmaster for a small (not for profit) club, and I've inherited the club website. Naturally, the source for many things are missing, including the main page http://www.mjoc.org.au/
    Is there anybody who could do me a great favour and decompile the attached file for me?
    There are several decompilers out there, but they all seem around the $100 mark, and the club can't afford such a thing, particularly as it's a one off, and may not be usable. I've tried a few trial versions, but they all have limitations which don't produce a viable .FLA.
    Any help greatly appreciated.

    I have to say, decompiling a swf saved my arse once, big time.
    It was a file that I authored, and had a lot of AS in it that i had done for the first time and it took several days to do.  I was working on it in three different locations and ultimatley didn't save the most recent version.  Of course I didn't discover this until about 6 monthes later when I had to make some updates.
    I couldn't remember what I'd done in the code, or how I did it or anything.  I also broke a cardinal rule of programming and didn't document what I did either.  So I ran the decompiler, all the code was intact and I breathed a HUGE sigh of relief and vowed to never ever let my files get out of sync again!

  • Need help with embedded SWF Playing

    I have an embedded SWF file (A 4 photo slide show) created in Flash Professional CS5, Action script 3, flash player 10 selected.
    I have placed this into the flash catalyst CS5 file. The file previews in the browser perfectly.
    The problem is when published it will not start the slideshow until you refresh the browser (Safari and FireFox) the local version runs fine
    the published version does not even when uploaded to the web server. www.ngambaisland.com
    This site was woking properly before I made some changes to the slide show and rebuilt the file to optimize it for loading performance.
    Please help if you can,
    Many Thanks,
    Curtis

    Thanks for looking but I have tested the website on 5 different computers an the slide show only activates after you hit the screen refresh button.
    I am afraid I am a bit limited in flash. You mentioned to check access settings. I used the default action script 3 settings in the publish settings.
    Could you please be more descriptive as what to look for or what settings I would need to change?
    Thanks for your help.
    Curtis

  • I Need Help Getting My .SWF to Work

    Good afternoon,
    I have developed a website using CS3 Dreamweaver. On my index.html page I have entered a .swf file from CS3 Flash for an animated intro, and I created a flash "ENTER" button in Dw. Everything works fine when I go to preview it in Dw using the safari browser. However, when I upload the files to the server and then go to my site using the internet by way of the safari browser it doesn't show up! The background shows up, but not the flash animation or the flash button. Can someone please help me with this? The web site is www1.pacific.edu/~psilva1/index.html. Below is the code that is currently on this page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <style type="text/css">
    <!--
    body {
         background-image: url();
         background-color: #000000;
    #imgholder {
         width: 940px;
          margin: 0 auto;
    body,td,th {
         font-family: Gill Sans;
    </style>
    <title>Welcome To Ammocan's Graphic Design Portfolio Utilizing Creative Ideas</title>
    <meta name="Keywords" content="welcome, ammocan, graphic, design, portfolio, creative, idea, art, adobe, illustrator, photoshop, dreamweaver, fireworks, flash, rendering, logo, branding, publication, typography, web page, business, tattoo, animation, " />
    <meta name="Description" content="Two Drops In A Bucket Graphx is a creative graphic design company owned and operated by "the="the" designer="designer"" ammocan, which="which" is="is" operated="operated" out="out" of="of" stockton,="stockton," ca.="ca." />
    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <div align="center">
      <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','name','Intro','width','940','height','800','id','Intro','title','Intro','src','assets/flash/intro','loop','false','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','scale','exactfit','movie','assets/flash/intro' ); //end AC code
      </script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" name="Intro" width="940" height="800" id="Intro" title="Intro">
        <param name="movie" value="assets/flash/intro.swf" />
        <param name="quality" value="high" /><param name="LOOP" value="false" /><param name="SCALE" value="exactfit" />
        <embed src="assets/flash/intro.swf" width="940" height="800" loop="false" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" name="Intro" scale="exactfit"></embed>
      </object>
      </noscript>
    </div>
    <div align="center">
      <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','name','Enter','width','105','height','21','align','absmiddle','id','Enter','title','Enter','src','assets/flash/button1','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#000000','movie','assets/flash/button1' ); //end AC code
    </script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" name="Enter" width="105" height="21" align="absmiddle" id="Enter" title="Enter">
        <param name="movie" value="assets/flash/button1.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#000000" />
        <embed src="assets/flash/button1.swf" width="105" height="21" align="absmiddle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#000000" name="Enter"></embed>
      </object>
      </noscript>
    </div>

  • Need help with combining swf files together

    Hi Everyone
    I have problem with my project.
    I created several SWF files, now i want them to interact with each other
    So there is main SWF file lets call it:
    main.swf
    then within that file(main.swf) i would like to create buttons which will be calling other swf files for instance by pressing one button one.swf will be open by pressing other button two.swf will be open and so on.
    Then I would like to create buttons within one.swf and two.swf which will allowed to go back to main.swf
    If someone could help me how to do it I will be grateful.
    AS2.0 i am working with
    many thanks

    thanks for quick respond
    So the first of all my main.swf would load, within it i would have a button. If i click on button will take me to frame 40 ( just example ) where i will have this.loadMovie("first.swf"), when this file will be loaded i want to have other button with in the first.swf which will take me back to main.swf and now you are suggesting to use this.removeMovie("first.swf")?
    I am not sure if i got you answer right
    Thanks again for help i am quite new to ActionScript as you can tell.

  • Need help playing 2 SWFs in sequence

    I have two SWFs that I want to play in sequence, using a
    third SWF (that has nothing besides this code). This should be
    simple -- play the first, wait for its timeline to end, then play
    the second. Problem is I can't get the timeline to wait.
    To load the first movie in frame 1, I have this, which works:
    this.createEmptyMovieClip("mcHolder", 1);
    var oListener:Object = new Object();
    var mclLoader:MovieClipLoader = new MovieClipLoader();
    mclLoader.loadClip("first movie.swf", mcHolder);
    mclLoader.addListener(oListener);
    In frame 10, I want to unload the first, then load the
    second. That happens, but w/o waiting. Here's what I have, so far:
    stop();
    if (_level1.currentFrame == _level1.totalFrames) {
    // unload first movie
    mclLoader.unloadClip(mcHolder);
    // now load next movie
    this.createEmptyMovieClip("mcHolder2", 1);
    var oListener2:Object = new Object();
    var mclLoader2:MovieClipLoader = new MovieClipLoader();
    mclLoader2.loadClip("second movie.swf", mcHolder2);
    mclLoader2.addListener(oListener2);
    I suppose there's something wrong with my If statement, but
    what?

    So other than the fact that my code was riddled with errors,
    it was fine!
    After implementing your instructions, I created an interval
    that runs the if-then statement 10x a second, then cleared the
    interval immediately after the If statement.
    One more question, though: the reason I was unloading the
    first movie was to clear up some memory. Are you saying that isn't
    necessary, since I'm now loading the second movie into a higher
    level?

  • Need help with embedded SWF in PDF as navigation

    Hi,
    I was wondering is there a way to have an embedded swf navigate to different pages of a pdf?
    Example:
    My swf is on page one. There are mulitple buttons in the swf, when clicked it will take you to page 3, or 5, or 7, etc.
    Currently, when I click on a button, it DOES take me to say page 4, but the content on page is the SWF file from page 1, and not the content that is suppose to be on page 4. Has anyone else experienced this problem?
    This is what I have in the flash action:
    btn_1994_1.addEventListener( MouseEvent.CLICK, p1994 );
    function p1994(e:MouseEvent):void{
         //addChild(pop_1994);
         doExternalInterfaceCall("gotoTarget", "pink");
    function doExternalInterfaceCall(myfncall, parm)
        flash.external.ExternalInterface.call(myfncall,parm);
    And this is what I have in the javascript of the pdf:
    function gotoTarget(name)
         this.gotoNamedDest(name);
    Please help me fix this problem.
    Thanks in advanced!
    ps. I am using Acrobat 9 Pro

    can anyone help?

  • Help unloading/removing SWFs!

    I've made this swfContainer in which 'var defaultLoad links to the default swf... After that I've made 2 buttons that link to my swfContainer. The problem is that when I click my links randomly, the swf files just keep piling onto each other, making the site more and more slow!
    How do I get my links to clear the container, while inserting a new swf file??
    I've tried with both the unload and removechild functions, but I can't seem to figure it out...
    Best regards
    Thomas
    See the code below:
    //Container
    var swfContainer:Sprite = new Sprite();
    addChild(swfContainer);
    swfContainer.x = 238;
    swfContainer.y = 167;
    //Default
    var defaultLoad:Loader = new Loader();
    var defaulturl:URLRequest = new URLRequest("content/rides.swf");
    swfContainer.addChild(defaultLoad);
    defaultLoad.load(defaulturl);
    //BUTTONS
    //Rides
    var rides_btn:ridesBtn = new ridesBtn();
    addChild(rides_btn);
    rides_btn.x = 115;
    rides_btn.y = 233;
    rides_btn.addEventListener(MouseEvent.CLICK, onClick1);
    function onClick1(event:MouseEvent):void {
    var ridesLoad:Loader = new Loader();
    var ridesurl:URLRequest = new URLRequest("content/rides.swf");
    swfContainer.addChild(ridesLoad);
    ridesLoad.load(ridesurl);
    //Information
    var info_btn:infoBtn = new infoBtn();
    addChild(info_btn);
    info_btn.x = 115;
    info_btn.y = 268;
    info_btn.addEventListener(MouseEvent.CLICK, onClick2);
    function onClick2(event:MouseEvent):void {
    var infoLoad:Loader = new Loader();
    var infourl:URLRequest = new URLRequest("content/info.swf");
    swfContainer.addChild(infoLoad);
    infoLoad.load(infourl);

    use:
    //Container
    var swfContainer:Sprite = new Sprite();
    addChild(swfContainer);
    swfContainer.x = 238;
    swfContainer.y = 167;
    //Default
    var loader:Loader;
    //BUTTONS
    //Rides
    var rides_btn:ridesBtn = new ridesBtn();
    addChild(rides_btn);
    rides_btn.x = 115;
    rides_btn.y = 233;
    rides_btn.addEventListener(MouseEvent.CLICK, onClick1);
    function onClick1(event:MouseEvent):void {
    loadF("content/rides.swf");
    //Information
    var info_btn:infoBtn = new infoBtn();
    addChild(info_btn);
    info_btn.x = 115;
    info_btn.y = 268;
    info_btn.addEventListener(MouseEvent.CLICK, onClick2);
    function onClick2(event:MouseEvent):void {
    loadF("content/info.swf");
    function loadF(urlS:String):void{
    if(loader!=null){
    swfContainer.removeChild(loader);
    loader.unloadAndStop();  // if publishing for fp 10
    loader=null;
    loader=new Loader();
    loader.load(new URLRequest(urlS));

  • Need help replaying a swf correctly with its music

    I created an eHoliday card and there is a button at the end of the swf that you can click to replay.
    It plays fine the first time but automatically replays at the end and there is no music the second time.

    my actionsript probably isn't set up right:
    for the replay button:
    on (release) {
    gotoAndPlay(2);

  • Need help with ext. SWF and XML

    I'm trying to create an External SWF to load into my main
    site (photography).
    Home | Portfolio | Published Work | Bio | Contact
    The SWF I want to load externally is Portfolio because it has
    5 sections
    Those 5 sections are:
    -Editorial
    -Adventure
    -Fly Fishing
    -Multimedia
    -Weddings
    I'm looking to keep this dynamic as possible, but I'm one of
    those guys who doesn't write code from scratch, but knows AS well
    enough to modify a base or a generic template if ever given. It
    would be easier to use one subsection as an example, which could be
    applied to all others.
    e.g. "Fly Fishing" 1-Main container; 5-10 thumbnails (1
    dyanamic thumbnailcontainer)
    - I don't know XML (but can modify it). basically having an
    ID tag for each image, possibly dynamically generate a thumbnail
    too. Also have a spot for dynamic text to load in (captions with
    multiple text lines for images upon onRelease - maybe this could be
    it's own MC that loads on top of the main photo container)
    - on (release) on a thumbnail: there would be a little
    information icon that would appear. If you mouse over, it would
    overlay a layer over that specific ID photo, and the text appear.
    RollOut it would fade out the layer above that specific ID photo.
    - Transition: FadeOut/Blur/Exposure Blur, something
    interesting to that nature.
    - Thumbnails: is it just easier to create thumbnail images
    manually, and just create a separate container?
    - Image folders: I would imagine each section would have
    it's own watch folder. For example "Fly Fishing" would be a folder
    "/swfImg_flyFishing/", but perhaps having one XML file.
    - XML file details
    id
    location
    caption summary
    title
    As you can see, if I had one template to build off of, I
    could repeat it self for the others. I need help and if there is a
    flash component (free or purchase) that does at least 70% of what I
    need, please share information. thank you!Portfolio

    I know doing a pushback to the client requires Flex Data
    Services, but since I don't use FDS I can't tell you exactly how.
    But look in the documentation about "pushing" data to the client.
    Once you've figured out how to do that, you can trigger that push
    once you've finished editing the xml file. You may want to ask over
    in the FDS forum.

  • I need help with controlling two .swf's from third.

    Hi, thanks for reading!
    I need help with controlling two .swf's from third.
    I have a problem where I need to use a corporate designed
    .swf in a digital signage solution, but have been told by the legal
    department that it can not be modified in any way, I also can't
    have the source file yada yada. I pulled the .swfs from their
    website and I decompiled them to see what I was up against.
    The main swf that I need to control is HCIC.swf and the
    problem is it starts w/ a preloader, which after loading stops on a
    frame that requires user input (button press) on a play button,
    before the movie will proceed and play through.
    What I have done so far is to create a container swf,
    HCIC_container.swf that will act as Target for the HCIC.swf, and
    allow me to send actionscript to the file I'm not allowed to
    modify.
    I managed to get that done with the help of someone on
    another forum. It was my hope that the following script would just
    start HCIC.swf at a frame past the preloader and play button, and
    just play through.
    var container:MovieClip = createEmptyMovieClip("container",
    getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("MCIC.swf", container);
    function onLoadInit(mc:MovieClip) {
    mc.gotoAndPlay(14);
    But unfortunately it didn't solve my problem. Because there
    is a media-controller.swf, that is being loaded by HCIC.swf that
    has the controls including the play button to start HCIC.swf.
    Here's a link to a .zip file with all 3 .swf files, and all 3
    .fla files.
    http://www.axiscc.com/temp/HCIC.zip
    What I need to do is automatically start the HCIC.swf file
    bypassing the pre-loader and play button without editing it or the
    media-controller.swf in anyway. So all the scripting needs to be
    done in HCIC_container.swf.
    I know this is confusing, and its difficult to explain, but
    if you look at the files it should make sense.
    ActionScripting is far from my strong point, so I'm
    definitely over my head here.
    Thanks for your help.

    Got my solution on another forum.
    http://www.actionscript.org/forums/showthread.php3?t=146827

Maybe you are looking for

  • Can a HP B210 AIO printer be connected to 2 different wireless networks at the same time?

    I live in a household that has 2 different wireless networks in it (both me and my roommate have our own networks) and we just bought a new B210 series AIO printer.  The printer detects both of our networks but only will print from one network at a t

  • Created control/usr/pwd now i can't loginto Mysql

    When setting up a config file for phpmyadmin, I set up a control user and password, and now when I try to log into mysql I get the message "Wrong username/password. Access denied". But when i try logging into Mysql using the command promt, I get acce

  • New iTunes crashes everytime I open the app tab for my ipad

    I downloaded then newest iTunes because I upgraded to iOS 7. The problem is, I can't add new files to my document or Adobe app since everytime I click on the "App" tab on Itunes, it suddenly crashes. Anyone knows any solution to this? This never happ

  • Transferring playcount

    I am transferring my itunes from pc to mac. I transferred all my music by homeshare. I then wanted to transfer my playlists, playcounts and ratings etc. I copied the library file from my pc and have saved this in itunes on my mac and this has picked

  • Internet speed test EA6500

    Hi guys, sorry for my english. I've a problem with the internet speed of my ADSL line(20Mega). Now I've the following components: Dlink DSL-320B(modem)+Cisco Linksys EA6500. If I start a Speed test the result its only 4M in download, while i remove t