Loading external SWF files: make things simple... Still need to help here =)

Hi all! First of all, sorry for my English... I'm Brazilian and English is not my mother tongue.

This is my first post , supposed to be my first post and I'm learning AS3. Didn't know this forum, but now I hope to have time to visit it a lot for help and be helped! =)

Well, I am trying to import external files to my main flash with buttons file. Yes, this is a newbie question, but I'm learning... I click the button 1 and content 1 is loaded, click on the button 2 and content 2 is loaded and so on. So, I got two ways to do:

edit: The code below works fine now...

montreal.addEventListener (MouseEvent.MOUSE_UP, loadCity);
dublin.addEventListener (MouseEvent.MOUSE_UP, loadCity);
sydney.addEventListener (MouseEvent.MOUSE_UP, loadCity);
...

var box: MovieClip = new MovieClip();
addChild (box);
Box.x = 20;
Box.y = 20;

function loadCity (event: MouseEvent): void {}
currentCity var = event.target.name;
remove all the children from the box
While (box.numChildren > 0) {box.removeChildAt (0) ;}}
var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
var swfLoader:Loader = new Loader();
swfLoader.load (swfRequest);
box.addChild (swfLoader) ;}

The problem with this first selection, is that whenever I click on a button, it repeats the content of the 'box'... instead, the loaded content is stacked on the last of them, and I know not how to clean it... The user Andrei toured with the statement "all" so that the code above works, but I don't know how to use tween with him...

So here's the second option:

Import fl.transitions.Tween;
Fl.transitions.easing import. *;

Montreal .buttonMode = true;
dublin.buttonMode = true;
sydney.buttonMode = true;
rio.buttonMode = true;
paris.buttonMode = true;
london.buttonMode = true;
home.buttonMode = true;

var box: MovieClip = new MovieClip();
addChild (box);
Box.x = 20;
Box.y = 20;

var cityLoader:Loader = new Loader();
var cityURL:URLRequest = new URLRequest ("montreal.swf"); I use it to show a city when the site is open
cityLoader.load (cityURL);
box.addChild (cityLoader);

* Here I add headphones to button, each calling its own function as:

montreal.addEventListener (MouseEvent.CLICK, loadMontreal);

function cityTweens (): void {}
var cityIn:Tween = new Tween (box, "y", Strong.easeOut,-350, 20, 1, true) ;}

function loadMontreal(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("montreal.swf");
cityLoader.load (cityURL);
cityTweens() ;}

function loadDublin(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("dublin.swf");
cityLoader.load (cityURL);
cityTweens() ;}

function loadSydney(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("sydney.swf");
cityLoader.load (cityURL);
cityTweens() ;}

function loadRio(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("rio.swf");
cityLoader.load (cityURL);
cityTweens() ;}

function loadParis(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("paris.swf");
cityLoader.load (cityURL);
cityTweens() ;}

function loadLondon(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("london.swf");


cityLoader.load (cityURL);
cityTweens() ;}

function loadHome(event:MouseEvent):void {}
var cityURL:URLRequest = new URLRequest ("home.swf");
cityLoader.load (cityURL);
cityTweens() ;}


Well well, the second option "" works, but I have some problems with interpolation of... I have to wait the Tween to complete before you click another button or the interpolation will be bug... I know not how to disable buttons until the Tween is finished .

Now, I used to have a Tween for each function, but now I got inside a function and just call it inside each function. Simple for you but I thought WOW, when I had the idea and put it into practice! But I repeat myself again a lot of code here with the "cityLoader.load (cityURL); but when I try to put it inside the function "cityTweens", it will just open the city of Montreal, maybe because I'm the appellant as soon as the site opens...

I'm pretty sure I can make simple things, like mixing the idea of the first code (currentCity + ".swf") so I do not need to call a function for each button. I don't know how... ...

Could someone help me? Also, I will be VERY happy if you give me a tip as good practices that I'm not following.
Thanks in advance!

Post edited by: newToAS3

Adjustments to the code that deal with it below. This is not a complete code - make full changes yourself.

import flash.events.EventDispatcher;
// hold all the buttons in an array
var buttons:Array = [montreal, dublin, sydney, rio, paris, london, home];
// add listeners
addListeners();
// function that adds listeners
function addListeners() {
     for (var k:String in buttons) {
          EventDispatcher(buttons[k]).addEventListener(MouseEvent.CLICK, loadSWF);
     }
}
// removes event listeners
function removeListeners() {
     for (var k:String in buttons) {
          EventDispatcher(buttons[k]).removeEventListener(MouseEvent.CLICK, loadSWF);
     }
}

function loadSWF(e:MouseEvent):void {
     // remove listeners
     removeListeners();
     // the rest of code goes here
}

function tweenFinished(e:TweenEvent):void {
     // add listeners back
     addListeners();
     // make Tween instance eligible for arbage collection
     e.target.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
     // now you can remove tweened object from the box
     box.removeChild(e.target.obj);
     e.target.obj = null;
}

Tags: Adobe Animate

Similar Questions

  • Loading external SWF files: make things simple...

    Hi all! This is my first post and I'm learning AS3 =)

    I didn't know this forum, but now I hope to have time to come hear a lot, to help and be helped!

    Well, I am trying to import external files to my main flash with buttons file. Yes, this is a newbie question, but I'm learning... I click the button 1 and content 1 is loaded, click on the button 2 and content 2 is loaded and so on. So, I got two ways to do:

    * various buttons with the listeners to run the function 'loadCity '.

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    function loadCity (Event: MouseEvent): void {}
    var currentCity = Event.target.name;
    var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load (swfRequest);
    box.addChild (swfLoader); }

    The problem with this first selection is that the content of the box is not renewed with each click, but he stacked one on the other, so I can't use it.

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    var cityLoader:Loader = new Loader();
    var cityURL:URLRequest = new URLRequest ("montreal.swf");
    cityLoader.load (cityURL);
    box.addChild (cityLoader);

    * various buttons with listeners to run its own functions, such as 'montreal.addEventListener (MouseEvent.CLICK, loadMontreal)';

    var box: MovieClip = new MovieClip();
    addChild (box);
    Box.x = 20;
    Box.y = 20;

    function loadCity (Event: MouseEvent): void {}
    var currentCity = Event.target.name;
    var swfRequest:URLRequest = new URLRequest (currentCity + ".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load (swfRequest);
    box.addChild (swfLoader); }

    The problem with this first selection is that the content of the box is not renewed with each click, but he stacked one on the other, so I can't use it.

    You can remove all the children from the box before placing another object inside:

    function loadCity (event:MouseEvent):void {
         var currentCity = event.target.name;
         // remove all the children of the box
         while (box.numChildren > 0) {
              box.removeChildAt(0);
         }
         var swfRequest:URLRequest = new URLRequest(currentCity + ".swf");
         var swfLoader:Loader = new Loader();
         swfLoader.load(swfRequest);
         box.addChild(swfLoader);
    }
    

    I see that you intend to use tween - in this case code above you does not have transitions gracefully...

  • AS2 button table to load external swf files

    Hey everybody.  Someone here recently helped me tremendously with a question I had on the creation of a back button in my flash file, allowing the user to click the button and view the file before swf.  I hope someone can help me make the next button now, too.

    I have a movieclip that loads an external swf files table.  I thought that the next button would be as simple as changing a selection just few things for the previous button.  However, this does not work.  When I try it, the movieclip doesn't even load the swf files.  Here's my AS2 code for my folder.  I have bolded the part at the end is for the previous button.  Does anyone know how to make the back button?

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    Function to load the film "next".  It uses the current value of currentSwf
    to access the table of sovereign wealth funds, then increments this value.  This version loops
    around at the beginning after the last of them.

    function loadNext (): Void {}
    mcl.loadClip (SWF [currentSwf], theTargetClip_mc);
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    }

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;
    }
    }
    }

    loadNext();
    function loadNext (): Void {}
    If (currentSwf > = swfs.length) return;
    mcl.loadClip (sovereign wealth funds [currentSwf], theTargetClip_mc);
    currentSwf ++;

    }

    function loadPrevious (): Void {}

    if(currentSwf>1) {}


    currentSwf-= 2;


    loadNext();


    }


    }

    rewind_btn.onRelease = loadPrevious;

    You must change your code so that the value of currentSwf reflects the real current swf being viewed.  It makes it easier to manage in the aspect of thinking.  While I'm not show all your code, here's how I recommend you change functions, by adding one specifically for loading, and change the other just increment/decrement the value currentSwf.

    function loadNext (): Void {}
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    loadSWF (currentSwf);
    }

    function loadSWF (nextSWFToLoad) {}
    mcl.loadClip (SWF [nextSWFToLoad], theTargetClip_mc);
    }

    loadSWF (currentSwf);

    function loadPrevious (): Void {}
    -currentSwf;
    if(currentSwf==-1) currentSwf = swfs.length - 1;
    loadSWF (currentSwf);
    }

    rewind_btn.onRelease = loadPrevious;

  • Problem with loading external swf files

    Hello

    I am currently working on a project which is an interactive and dynamic elemtry school presentation to the Denmark. I finished my project and it works perfectly, but only locally on my computer.

    The final draft should be implemented on the site and public work. I tried to implement the project on the site and unfortunately, it does not work as expected.

    When all the files where transferred to the ftp server, only a single files are responding and appear correctly.

    Interactivity of the project is based on a structure of Action script, which is based on the smooth transition between swf files (load another swf file after the action is triggered by clicking on a button) do any work.

    After days of trying to figure out the solution, I'm totally lost. One thing is to publish the project so that all action script will work and answer between swf files, and the other thing is to make it user-friendly for the Android and apple products.

    The presentation is quite heavy because of its loading external swf content files, which are images and movies.

    I really hope you can help me with my problem. I will gladly share the files and codes if it would help solve the problem.

    Best regards

    Agata

    It could be a problem of location of file from loading.  When you place a swf file in an HTML base for targeting anything that the SWF load becomes the folder of the html page.  You may need to adjust the target so that the target of swf files, load it as if it were in the same folder as the html page.

  • Loading external SWF files...

    I hope that I can make sense of it. I have my main SWF, which is a background image and a bar of buttons at the bottom. When you click on one of the buttons, the loader object is another SWF to cover the bottom. First time isn't a problem, but if you click on another button at the bottom, the original background image flashes through the new page will load in.

    I know this isn't a big deal, but it bothers me. How can I go about creating a smooth transition between files?

    Place the background image into a MovieClip. Place the MovieClip on the stage where you got the background image. Give it a name in the Properties window for the instance on the stage and then his set _visible to false on all buttons or call a function from buttons that does this.

    However if you use loadMovie, you will always see a difference if the same target is used because the target is destroyed at the beginning of the loadMovie method and until the internet serves the first frames of the external swf file target is empty.

    A buffering approach can be explored by using more than one target, MovieClipLoader and exchanging multiple depths (or interpolation of transition) when the MovieClipLoader.onLoadInit method is called.

  • How to load external swf files into the AIR

    I try this code its working at the computer, but when I publish this .apk or .ipa file, my external swf file does not open

    (I included my external file as well)

    places_btn.addEventListener (MouseEvent.MOUSE_DOWN, newvid);

    function newvid(event:MouseEvent) {}

    trace ("you clicked me");

    var loadit = new Loader();

    addChild (loadit);

    loadit. Load (new URLRequest ("scene02.swf"));

    }

    01.jpg

    Add this in your newid function:

    You forgot to put the beginning of your original function:

    var loadit = new Loader();

    addChild (loadit);

    var _lc:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

    loadit. Load (new URLRequest ("scene02.swf"), _lc);

  • Load external swf file

    Hi all

    I am trying to load an external SWF file in my site... but it does not work. Here is my code

    public var CD:Loader = new Loader();

    protected function application1_creationCompleteHandler(event:FlexEvent):void

    {

    CD.load (new URLRequest ("http://localhost/assets/slide.swf"));

    addChild (this. (CD);

    CD.x = 2;

    CD.y = 170;

    / / TODO self-generated stub method

    }

    Can someone tell me what goes wrong...

    The url is correct and his works in my browser when I type " " http://localhost/assets/slide.swf ' in the browser... So the problem is with flex...

    I tried to load this swf into my project and it crashed the browser.  What is written this swf?  AS3 or earlier?  If I'm not mistaken load one previous VERSION other than 3 will cause additional problems and needs to work to spare but I'm not 100% sure.

  • Help please! Problems with loading external swf files

    I'm scared, I'm new to both Adobe Flash and Actionscript 3.0.

    I'm trying to create a simple site using a couple of different external sovereigns loaded into a main swf file.

    For the moment, in the timeline panel, I have the following code in frame 1 of the layer actions:

    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 (66);
    }
    aboutme_btn.addEventListener (MouseEvent.CLICK, showaboutme);
    function showaboutme (myEvent:MouseEvent): void {}
    gotoAndPlay (49);
    }
    gallery_btn.addEventListener (MouseEvent.CLICK, showgallery);
    function showgallery (myEvent:MouseEvent): void {}
    gotoAndPlay (76);
    }

    var bgLoader:Loader = new Loader();
    stage.addChild (bgLoader);
    ("var url: URLRequest = new URLRequest("Background/sitebackground/Main.swf ");
    bgLoader.load (url);
    stage.setChildIndex (bgLoader, 0);

    Then, in the framework of 76, I have the following code:

    removeChildAt (0);
    bgLoader.unload ();

    In section 77:

    var galleryLoader:Loader = new Loader();
    stage.addChild (galleryLoader);
    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);
    stage.setChildIndex (galleryLoader, 0);

    Stop();

    The idea is that, when the file is loaded, the 'sitebackground/Main.swf"flash loads on the stage. Then I want to delete this flash and load a different one when I click on the gallery_btn. So, when I click on the gallery_btn, he plays frame 76, theoretically unloading the Main.swf and the loading of the ZenGalleryDemo.swf in its place.

    For the moment, the Main.swf loads perfectly and works great. But when I click on the button to the Gallery, he jumps to the frame 76 and plays the Main.swf. It does not load the file ZenGalleryDemo.swf...

    If anyone has any ideas, I would be really grateful!

    Thanks in advance

    It's just a glance and reading, but the problem may lie between these two lines... look closely...

    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);

  • How to load external swf file and unload the swf file parent?

    I have a question. Let's say I have file1.swf, file2.swf and file3.swf, how can I link this 3 files together.

    Let's assume that file1.swf is the main content file, but as I load file2.swf, I want the file1.swf get replaced by file2.swf. How could unload file1.swf at that time, so that my file2.swf will become the main content file?

    and even once, when my current post file2.swf and I want it get replaced by file3.swf tinkle of a button. so that i can unload the file2.swf and let them file3.swf become the main content file...
    Anyone have ideas on this?
    Thank you..

    If you're publishing to fp 10 + use:

    var loader: Loader = new Loader();

    var urlR:URLRequest = new URLRequest();

    addChild (loader);

    Btn1.addEventListener (MouseEvent.Click, f);

    btn2.addEventListener (MouseEvent.Click, f);

    function f(e:Event):void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    {if(e.currentTarget==btn1)}

    urlR.url = "file2.swf";

    } else {}

    urlR.url = "file3.swf";

    }

    Loader.Load (urlR);

    }

    p.s. Please check the useful/correct, if there is.

  • Preloader which modifies the external SWF files every 5 seconds

    Hello

    I made a web banner in flash that loads an external swf and another external swf changes after 5 seconds. The banner have a preloader, but the problem becomes when you load the first time. As sovereign wealth funds are not cached in the cache of the browser and yet, time 5 seconds start counting from the preloader, and when the external swf file, shows only 1 second rest and it is replaced by another. There is a way to 'freeze' the time for each external swf until it loads completely?

    The code that loads SWFs every 5 seconds (this code is placed in a layer of action):

    start of the code:

    var intervalId: number;
    var: number = 0;
    var maxCount:Number = 23;
    var duration: number = 0;
    var banners: Array = new Array)
    "abatrade.swf,"
    "bancobrasil.swf,"
    "caparao.swf,"
    "cedro.swf,"
    "cesama.swf,"
    "copasa.swf,"
    "damatta.swf,"
    "emtel.swf,"
    "engedrain.swf,"
    "extel.swf,"
    "feedback.swf,"
    "iti.swf,"
    "intermedium.swf,"
    "magnesita.swf,"
    "maquenge.swf,"
    "maxxdata.swf,"
    "orteng.swf,"
    "paiva.swf,"
    "paraibuna.swf,"
    "paraopeba.swf,"
    "sabesp.swf,"
    "serpro.swf,"
    "soll.swf,"
    'thawte.swf '.
    );

    function executeCallback(param:String) {}
    var duration: number = 5000;
    loadMovie (banners [count], loadmovie_mc);
    loadmovie_mc._x = 0;
    loadmovie_mc._y = 0;

    clearInterval (intervalId);
    if(Count < maxCount) {}
    Count ++;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    }
    else {}
    Count = 0;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    }
    }

    If (intervalId! = null) {}
    clearInterval (intervalId);
    }

    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);

    end of the code
    ----------------------------------------

    And the code to the preloader (this code I place in the movieclip that loads external SWF files):

    start of the code:

    {onClipEvent (enterFrame)}
    var gtT:Number = this.getBytesTotal ();
    var gtL:Number = this.getBytesLoaded ();
    var gtP:Number = int ((gtL/gtT) * 100);
    If (TWG > gtL) {}
    This ._alpha = 0;
    _root. Loader._alpha = 100;
    _root. Loader.bar._width = gtP;
    clearInterval (intervalId);
    } else {}
    This ._alpha = 100;
    _root. Loader._alpha = 0;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    delete onEnterFrame;
    }
    }

    end of the code

    Note that I tried to freeze the time using a clearInterval does in the second code, but he simply doesn't work...

    Any ideas? Thank you

    Edson

    Here's the correct code kglad send me. Thank you very much!

  • How to determine the total number of images in the external .swf file loaded

    I have to be able to load both external .swf files and make them play in order. To do this, I need to know the number of images in the first .swf file so I can check _currentframe against _totalframes to determine when he is finished playing so that I can load another.

    Most of the stuff I see indicate that _totalframes on an external .swf can be determined by loading the .swf in a container clip and then check using a listener in the .onLoadInit. Like this:

    ------------------------------------------------------------------------------------------ ----------------------------

    this.createEmptyMovieClip ("tester_mc", 1);
    var mcListener:Object = new Object();

    mcListener.onLoadInit = {function (target_mc:MovieClip)}
    target_mc.onEnterFrame = function() {}
    If (this ._currentframe > = this ._totalframes) {}
    trace ("total frames =" + this ._totalframes);
    delete this.onEnterFrame;
    } else {}
    trace (target_mc._currentframe + "OF" + target_mc._totalframes);
    }
    }
    }

    var test_mc:MovieClipLoader = new MovieClipLoader();
    test_mc. AddListener (mcListener);
    test_mc.loadClip ("Ad_Group.swf", tester_mc);

    ------------------------------------------------------------------------------------------ -------------------------------------

    Unfortunately, this doesn't seem to work. The trace will always return a total number of frames of 1.

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I would appreciate any ideas on how to raise the total number of frames of an external .swf file or, Alternatively, put it another way when it's done playing. (Not only the loading, but play until the end.)

    TIA,

    C

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I wouldn't imagine. My guess is that the main scenario for the external swf file has only 1 frame and the rest of the animation is inside a movieclip in this timeline. You publish this swf? Can you open the FLA and check how many images is open on the main timeline?

    The approach that you have mentioned is about what there is. But he knows check a chronology. If there are many nested movieclips, it may be impossible to understand what timeline you really want to be 'THE' full chronology.

    If you have the FLA, you can have the video call function on the _root timeline which tells the main swf that has completed a movieclip or something like that.

    Also, I have in my head somewhere that I recently saw something that someone made similar to this one, but do not remember... If it appears in my head that I will post.

  • How to prevent the sounds of the timeline in external swf files to play during the loading?

    I'm having a problem with the sounds of the external timeline in the swf files play while charging in a main swf file. Can someone help me?

    Here is a part of the main code of the swf. I hope I got enough.

    Thank you.

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    import flash.display.Loader;

    to import flash.events.ProgressEvent;

    import flash.events.Event;

    import flash.net.URLRequest;

    Import fl.events.SliderEvent;

    import flash.media.SoundTransform;

    preloader_mc.fill_mc. ScaleX = 0;

    var swfA:Array = ["part1.swf", "part2.swf"];

    var frameA:Array = [];

    var currentLoader:Loader;

    var swfTotalFrames:int;

    var tl:MovieClip =;

    var st:SoundTransform = new SoundTransform()

    var int index = 0;

    loadNextF();

    play_slider. Enabled = false;

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    TL ["loader_" + index].contentLoaderInfo.addEventListener (ProgressEvent.Progress, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.Complete, completeF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function progressF(e:ProgressEvent):void {}

    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);

    preloader_mc.fill_mc. ScaleX = fractionLoaded;

    preloader_mc. TF. Text = (100 * fractionLoaded) + "% Loaded";

    }

    function completeF(e:Event):void {}

    TL ["loader_" + index].contentLoaderInfo.removeEventListener (ProgressEvent.PROGRESS, progress F);

    TL ["loader_" + index].contentLoaderInfo.RemoveEventListener (Event.Complete, completeF);

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    frameA.push (mc.totalFrames);

    index ++;

    if(index<swfA.Length) {}

    loadNextF();

    } else {}

    / / full of all charges.  start playing.

    restart_mc.buttonMode = true;

    restart_mc.Alpha = 1;

    tl.addEventListener (Event.ENTER_FRAME, playUpdateF);

    tl.removeChild (preloader_mc);

    preloader_mc = null;

    play_slider.enabled = true;

    playpause_mc.Alpha = 1;

    currentLoader = tl ["loader_0"];

    tl.addChild (currentLoader);

    MovieClip (currentLoader.content) .play ();

    sliderParamsF();

    }

    }

    I have about 70 sounds in my two external SWF. What I need to stop all of them?

    //---

    more than likely, Yes. I guess it depends on how you have 70 put sounds up in your external swf file... I mean:

    you have 70 movieclips appointed on the external swf stage with a distinct sound in each of them? and each have a stop() action in the first picture?

    or

    you say your external swf to go to a certain image tag that plays a sound on the timeline to this label?

    or

    are your 70 sounds created dynamically with code and told. start()?

    //---

    Keep in mind, a swf loading will start to play even before it is fully charged. So instead of when it is fully charged, try stop the loaded swf with a listener for 'init', i.e. when the swf file loaded passes its first image:

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    . contentLoaderInfo.addEventListener TL ["loader_" + index] (ProgressEvent. COURSES, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.COMPLETE, completeF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.INIT, initF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function initF(e:Event):void {}

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    }

  • How to make reference to the external SWF file using if statement?

    I have a main swf file that loads several external SWF file when the user clicks a menu button. Now I want to target a specific swf file to Add an extra library child or of another swf when this specific swf file is loaded. How should I do? What should I put in the stated case?

    ///////////////////////////////////////////////////////////

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    addChild (loader); dynamically load SWFs

    If (newswf == ".") ("/ SWF/pubResCHETNA.swf ') //error here

    {

    FC.buttonMode = true;

    FC.addEventListener (MouseEvent.CLICK, full screen);

    }

    function fullScreen(e:MouseEvent):void

    {

    var loaderF:Loader = new Loader();

    loaderF.load (new URLRequest ("PopupFullscreen.swf"));

    addChild (loaderF);

    }

    ////////////////////////////////////////////////////////

    The State must be newswf.url == the path. However I store event.target.name as a variable and use it in the State. You use "." for your path so the condition probably will always fail.

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • Loading and handling external SWF files

    I'm new to the Flex development environment.  In the past, when we put a large application in Flash, load us SWFs and pass relevant data.  I've created a flex application and want to load the swf compiled from another flex project.  I can do this and swf games, but how can I have access to the properties and methods of the loaded swf file?

    I was loading active flash converting them for bending of components customized by using the Flex components, but I don't want to put all my flash content in the components and add them to a large project because it would make a huge swf if all these swcs are included in the compilation.  Is it possible to load a swf file and access its attributes?  Or what I need to rework the way I build a large application consisting of many SWFs in the past?

    Sovereign wealth funds are loaded asynchronously, so that they are not guaranteed to be there by creationComplete.  The Protocol is to use the Event.COMPLETE to listen the FlexEvent.APPLICATION_COMPLETE of the loadedSM, then loadedSM.application must be valid.

    Note that if you type-casting of the application, you end by linking the application in the main SWF file classes, defeating the point of having a sub-application.  Use an interface or just loadedSM.application ["receiveObjects"])

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Cannot load external swf

    Hello

    Im trying to load an external swf into my project, the code is simply:

    var loader: Loader = new Loader;

    Loader.Load (new URLRequest ("gallery.swf");

    I get an error that says the following when it debug.

    TypeError: Error #1009: cannot access a property or method of a null object reference...
    at gallery_fla::MainTimeline/frame1()
    Cannot view the source code at this location

    I have done this same thing before but never got this error message, I tried to load a swf file that is old and it worked fine.

    IM totally lost here, any help is very appreciated.

    Because the error is pointing Gallery fla, it can be that the problem lies in the SWF Gallery.  What you need to do, is to enter your Setings publish and select the option to enable debugging.  This will help by joining the line number of the code problemed.  You think it's a number of top line to no matter what you have in the file doing the oading that would probably make most issues that's the file you load.

    Just in case you have copied and pasted, the following line should have thrown an error of syntax by lack a parenthesis...

    Loader.Load (new URLRequest ("gallery.swf");

Maybe you are looking for