Loading an external swf file

New to Flash and actionscript I have jumped in at the deep
end. I purchased a piece of pre written flash software with
editable XML to display an interactive UK map. This has come
without the Fla source. My problem is when trying to load the swf
into a movie clip on my stage I can not see the map. Something is
there because the cursor changes to a hand shape. I just used the
following line of code:
mc_loader.loadMovie("uk_ir_locator.swf")
where mc_loader is the instance name of an emty movieclip
symbol on my stage.The swf and XML file are both in the same
directory as my file. Can anyone help

AS3 is a completely different beast than AS1 or 2. loadMovie
was removed from the language.
The answer to your question is two fold. First, Adobe was
kind enough to give us the code when it finds a migration issue.
var _ldr:Loader = new Loader();
addChild( _ldr );
_ldr.load( new URLRequest( "your url") );
Handling progress has also changed. I have a ContentLoader
package on my site that you're free to use that should familiarize
you with the new way that things are done in AS3.
http://sd-dezign.com/blog/?page_id=10

Similar Messages

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Trouble loading an external swf file implemented with AS3

    I am using Adobe Flash CS3
    At first, I tried
    swf_mc.loadMovie("//swf file
    location");
    It gave me
    quote:
    Warning: 1060: Migration issue: The method loadMovie is no
    longer supported.
    USE: var l = new Loader(); addChild(l); l.load(new
    URLRequest("your url"));.
    Well, the given code isn't working at all.
    But since it is a migration error, I thought maybe I can just
    save it into Flash5 format with AS1. Then it worked with most
    external swf files. However, the one I am trying to load is a swf
    file with AS3, so my older version swf can't load it at all.
    Anyone has any ideas about how to load an external AS3 swf
    file?

    AS3 is a completely different beast than AS1 or 2. loadMovie
    was removed from the language.
    The answer to your question is two fold. First, Adobe was
    kind enough to give us the code when it finds a migration issue.
    var _ldr:Loader = new Loader();
    addChild( _ldr );
    _ldr.load( new URLRequest( "your url") );
    Handling progress has also changed. I have a ContentLoader
    package on my site that you're free to use that should familiarize
    you with the new way that things are done in AS3.
    http://sd-dezign.com/blog/?page_id=10

  • Can not load an external swf file from my site

    Hi ...
    I have a fla file which is loading external swf files from my local folders.
    I inserted some of the swf files to a web site and tried to load them from the site, not from my local folder...
    So it gave me a security error like below:
    *** Güvenlik Sanal Alanı İhlali ***security domain-area violation
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi -- security domain element, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı - tried to reach this incompatible url
    SecurityError: Error #2070: Güvenlik sanal alan ihlali -- security area violation: http://www.celiktek.com.tr/KIRIL.swf arayanı - searcher of this can not reach stage in file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor. -
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    so in my computer, I can load this swf , but how from a website ?
    thnx ...

    Thnaks ...
    I tried to use the securiyt panel that is openede and I added there my site
    www.celiktek.com.tr/KIRIL.swf
    but I still take the error
    *** Güvenlik Sanal Alanı İhlali ***
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı
    SecurityError: Error #2070: Güvenlik sanal alan ihlali: http://www.celiktek.com.tr/KIRIL.swf arayanı file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor.
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    from my code
    var req:URLRequest=new URLRequest("http://www.celiktek.com.tr/KIRIL.swf");
    var lod:Loader=new Loader();
    lod.load(req);
    addChild(lod);
    lod.x=0;
    does this code works on your computer ... I know it is a weird question ... you dont have to try ...

  • How to correctly load an external swf file into iosAir app? I'm getting blank screen.

    So this code works flawlesly on Air for Android, it even works fine when I test the movie in Flash, but once I export it, I'm getting a blank screen. I made an swf with a square and withotu any code, and flash still fails to load it. It's weird cause everything works fine when I use the interpreter debugging option, but when I switch to standard debugging the blank screen appears on my ipad. I've read somewhere that it's caused by the way flash saves the link to external files. Thus after the file is compiled Flash fails to find the prefiously added files, which results in a blank screen. There's clearly something wrong with how the process of compiling the application.
    Tried this:
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var loader:Loader = new Loader();
    var link:URLRequest = new URLRequest("Untitled-1.swf");
    loader.load(link);
    addChild(loader);
    And this:
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest("Untitled-1.swf"));
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded, false, 0, true);
    function loaded(event:Event):void {
    addChild(event.target.content);
    But nothing works. I'm still getting a blank screen. Is there any way to add the swf file manually into the descriptor file cause flash most likely messes it up? I don't really want to use through command line.

    Read this article, especially the bit about loadercontext and currentdomain:
    http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air- apps-on-ios/

  • Loading an External SWF Files not working

    Hello,
    So I have a project I am working on in which I would like to teach how to cash a scratch off card. I have made the scratch and made it so it will "scratch"
    Before:                                                                                                                                               After:
    Now I have saved this out and am trying to load this into my "holder" however I am getting an error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at ScratchTicket()
    When I use this code:
    stop();
    import flash.events.MouseEvent;
    nextPG_btn.addEventListener(MouseEvent.CLICK, nClick);
    lastPG_btn.addEventListener(MouseEvent.CLICK, lClick);
    function nClick(event:MouseEvent):void{
        nextFrame();
    function lClick(event:MouseEvent):void{
        gotoAndStop(3);
    var mcExt:MovieClip;
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    ldr.load(new URLRequest("ScratchTicketOnly.swf"));
    function swfLoaded(e:Event):void {
        mcExt = MovieClip(ldr.contentLoaderInfo.content);
        ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
        mcExt.x = 50;
        mcExt.y = 50;
        addChild(mcExt);
    What am I doing wrong?
    Is it because of my coding in the External SWF?
    package {
        import flash.display.Sprite;
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.ui.Mouse;
        public class ScratchTicket extends MovieClip{
            var scratcherIsActive:Boolean= false;
            var stuffUnderMask:Sprite = new Sprite();
            // init class
            public function ScratchTicket():void{
                stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseIsDown);
                stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseIsMoving);
                stage.addEventListener(MouseEvent.MOUSE_UP, mouseIsUp);
                // make mask           
                stuffUnderMaskClip.mask = stuffUnderMask;
                addChild(stuffUnderMask);
                makeCursor();
            // helper functions
            private function makeCursor():void{           
                trace("Custom cursor can go here");
            // hover effects
            private function mouseIsDown(e:MouseEvent):void{
                //Mouse.hide();
                Mouse.cursor="hand";
                scratcherIsActive = true;
            private function mouseIsUp(e:MouseEvent):void{
                //Mouse.show();
                Mouse.cursor="arrow";
                scratcherIsActive = false;
            private function mouseIsMoving(e:MouseEvent):void{
                if(scratcherIsActive){
                    stuffUnderMask.graphics.beginFill(0x000000);
                    stuffUnderMask.graphics.drawEllipse(mouseX, mouseY,60, 60);
                    stuffUnderMask.graphics.endFill();
        }// class
    }// package
    Any help is great!

    Make sure you check for errors on loading..
    import flash.events.IOErrorEvent;
    ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, uhOhError);
    function uhOhError(e:Event):void
         trace(e);
         // probably put some visual text field here to display the error
    Aside that, on the first block of code mentioned, is that a frame script or running from somewhere in a class? If in a class and it doesn't extend a display object then you can't addChild(mcExt) without erroring.

  • Loading external swf file in a new window

    Hi,
    I've got a few .swf files with video tutorials I've created using Captivate 4.
    I wanted to link them so I've created a main screen with menu with buttons in Flash.
    I've added AS to load the external swf files but they load in the same window. How can I load these .swf files in seperate window so that you could get back to the main window after you've finished watching?
    Here's my code:
    stop();
    var myLoader:Loader = new Loader();
    button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
    function movie1_1(e:MouseEvent):void
        var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
        myLoader.load(myURL);
        addChild(myLoader);
    I'm also attaching screenshot with menu in flash

    I've deleted the line and now the code lookes like that:
    stop();
    var myLoader:Loader = new Loader();
    button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
    function movie1_1(e:MouseEvent):void
        var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
        addChild(myLoader);
    Unfortunately, it doesn't load the .swf file when you click on the button...

  • Loading external swf file

    Hi all,
    I am trying to load an external SWF file into my website.. but it is not working. 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 Auto-generated method stub
    Can anyone tell me what is going wrong..
    The url is correct and its working in my browser when i type 'http://localhost/assets/slide.swf' in the browser... So problem is with flex..

    I am pretty sure that Flash's security measures prevents the coder from loading swfs that are not local to the swf that is trying to load them.  So the swf that is trying to load another swf would have to be on the same system or same networked server.  From what I have experienced its best to reference the location of the files from the swf that is doing the loading.  I am not sure if you are still referencing your swf as "http://localhost/assets/slide.swf" but that might be a problem as well.
    so
    mainfolder
    movie.swf
    assets
    slide.swf
    so in movie.swf
    //Start: Put in desired function
    var swfLoader:Loader = new Loader();
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    swfLoader.load(new URLRequest("assets/slide.swf"));
    //End
    Also add this function
    public function loadComplete(e:Event):void
         stage.addChild(e.target.content);
    This might help explain it
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
    the first set of bullet points highlight the security options
    ps. I got this working on my end, copy and pasted the code, of course i had to recreate the file system structure and slide.swf

  • What is or isn't possible on iOS?  (Not having Loader, loadBytes(), external swfs, etc)

    My basic question is:  "What are the classes which we should not use for iOS using the packager."
    I have been trying for a few days trying to get a simple Flash app to run on the iPad.  A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue.  We will get to that).  But if I try anything else, all I get is a white/black screen on the iPad.  So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
    I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage.  Fairly common standard practice in AS3.
    I've read about not able to load an external file using the Packager.  So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work.  I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors:  http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows.  For example, AS3 in a swf is stripped out from an external swf using [embed].
    The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above).  This works great on the PC.  HOWEVER, on iPad, it fails.  The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work.  Is this true Adobe/Flash guys?  Can you confirm this?
    My initial question is "why is this not allowed on iOS?".  If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip?  I have a ByteArray with the raw swf/MovieClip data.  Why can't I construct a MovieClip from it without going through Loader?
    This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets.  If there are other ways people have found, please share!
    Now on to performance.  Adobe, can you post some examples/samples of code which runs at decent performance?  Like a "tech demo" of what is possible using the Packager running on iPad/iPhone.  That would be extremely helpful for everyone.  I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad.  Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast.  Quake runs on iPad without any problems and that code is 10 years old.  Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago...  I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
    So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible.  I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something.  But being forced to go native Objective-C seems to be my only option at this point.
    In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
    - Why is Loader not allowed on iOS?  Is it a technical limitation of the hardware/os/Flash?  Will it never be supported?  What is the future of this class on iOS?
    - Why is loadBytes() not allowed on iOS?  I have the raw embedded data in memory.  I don't need to make a remote call so security should not be an issue.  Can I create a MovieClip without using Loader?
    - Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]?  Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need.  (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
    - What are some apps you guys have written that we can use to compare PC vs iOS?  Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help.  If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know.  Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager.  I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release.  Flash can do some great things.  If it can do it on iOS, even better.  But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
    Thanks.

    I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
    Read this article, and get its associated demo files, to see some good performing tech demos:
    http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
    Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
    Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
    There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
    bmd.draw(innermc);
    var bm:Bitmap = new Bitmap(bmd);
    bm.x = 150;
    bm.y = 150;
    addChild(bm);
    So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it.

  • Loading multiple consecutive .swf files in Flash 8

    I have a question and hope that someone may be able to help;
    this might be a piece of cake for you...
    I have a container .fla movie and would like to load
    consecutive external .swf files. Right now I have a play button
    triggering the loading of the next movie, but what I would REALLY
    like is a smooth transition from .swf to .swf using a listener so
    that the next .swf will load once the previous one has finished. I
    have a counter which determines the next .swf in order.
    So far, my code is this:
    Counter:
    stop();
    //SETUP OUR COUNTER
    var mcCounter:Number = 0;
    //THIS BLOCK IS ONLY TO HANDLE THE LOADER AND THE FIRST
    MOVIE, movie0.swf
    var myMCL:MovieClipLoader = new MovieClipLoader();
    var loadListener
    bject = new Object();
    myMCL.addListener(loadListener);
    myMCL.loadClip("movie" + mcCounter + ".swf", 6);
    loadListener.onLoadComplete = function():Void {
    _level0.play();
    //-------------------------<CLIP
    LOADERS>------------------------------\\
    function loadNextClip():Void {
    if(mcCounter < 6) {
    mcCounter++;
    var nextMCL:MovieClipLoader = new MovieClipLoader();
    nextMCL.addListener(this);
    nextMCL.loadClip("movie" + mcCounter + ".swf",6);
    //LOADS PREVIOUS CLIP , WON"T GO PAST ZERO
    function loadPrevClip():Void {
    if(mcCounter > 0) {
    mcCounter--;
    var prevMCL:MovieClipLoader = new MovieClipLoader();
    prevMCL.addListener(this);
    prevMCL.loadClip("movie" + mcCounter + ".swf",6);
    //-------------------------</CLIP
    LOADERS>------------------------------\\
    Any suggestions? I appreciate ANY help you can offer. I have
    been unsuccessfully looking for hours online, and can't find any
    examples, although it doesn't seem as if it should be the hardest
    thing in the world.
    Thanks!

    You need a monitor to know when one movie clip has completed
    play. A simple
    monitor could be adding onEnterFrame handler to the
    container_mc when
    MovieClipLoader onComplete or onInit is fired. In that
    handler a test to see
    when the loaded clip's _currentframe == the loaded clip"s
    _totaframes.
    Ex:
    this.createEmptyMovieClip("container_mc",
    this.getNextHighestDepth());
    container_mc._x = 0;
    container_mc._y = 0;
    var swfNumber:Number = 0;
    var swfNumberMax:Number = 25;
    var swfNamePrefix = "MovieClipLoaderDetectEndOfPlay_Movie";
    var mclListener
    bject = new Object();
    mclListener.onLoadStart = function(target_mc:MovieClip)
    target_mc.startTimer = getTimer();
    mclListener.onLoadComplete = function(target_mc:MovieClip)
    target_mc.completeTimer = getTimer();
    mclListener.onLoadInit = function(target_mc:MovieClip)
    var timerMS:Number = target_mc.completeTimer -
    target_mc.startTimer;
    target_mc.play();
    target_mc.onEnterFrame = function()
    trace(this._currentframe)
    if (this._currentframe == this._totalframes)
    trace("Load Next Swf")
    loadNextSwf()
    var container_mcl:MovieClipLoader = new MovieClipLoader();
    container_mcl.addListener(mclListener);
    function loadNextSwf()
    swfNumber++;
    if (swfNumber <= swfNumberMax)
    var swfSuffix = ((swfNumber<10)?"0" :"") + swfNumber;
    container_mcl.loadClip(swfNamePrefix + swfSuffix + ".swf",
    container_mc);
    loadNextSwf()
    Lon Hosford
    www.lonhosford.com
    May many happy bits flow your way!
    "dragonlilly" <[email protected]> wrote in
    message
    news:[email protected]...
    I have a question and hope that someone may be able to help;
    this might be
    a
    piece of cake for you...
    I have a container .fla movie and would like to load
    consecutive external
    .swf
    files. Right now I have a play button triggering the loading
    of the next
    movie, but what I would REALLY like is a smooth transition
    from .swf to .swf
    using a listener so that the next .swf will load once the
    previous one has
    finished. I have a counter which determines the next .swf in
    order.
    So far, my code is this:
    Counter:
    stop();
    //SETUP OUR COUNTER
    var mcCounter:Number = 0;
    //THIS BLOCK IS ONLY TO HANDLE THE LOADER AND THE FIRST
    MOVIE, movie0.swf
    var myMCL:MovieClipLoader = new MovieClipLoader();
    var loadListener
    bject = new Object();
    myMCL.addListener(loadListener);
    myMCL.loadClip("movie" + mcCounter + ".swf", 6);
    loadListener.onLoadComplete = function():Void {
    _level0.play();
    //-------------------------<CLIP
    LOADERS>------------------------------\\
    function loadNextClip():Void {
    if(mcCounter < 6) {
    mcCounter++;
    var nextMCL:MovieClipLoader = new MovieClipLoader();
    nextMCL.addListener(this);
    nextMCL.loadClip("movie" + mcCounter + ".swf",6);
    //LOADS PREVIOUS CLIP , WON"T GO PAST ZERO
    function loadPrevClip():Void {
    if(mcCounter > 0) {
    mcCounter--;
    var prevMCL:MovieClipLoader = new MovieClipLoader();
    prevMCL.addListener(this);
    prevMCL.loadClip("movie" + mcCounter + ".swf",6);
    //-------------------------</CLIP
    LOADERS>------------------------------\\
    Any suggestions? I appreciate ANY help you can offer. I have
    been
    unsuccessfully looking for hours online, and can't find any
    examples,
    although
    it doesn't seem as if it should be the hardest thing in the
    world.
    Thanks!

  • How to unload the external .swf file when move on to other section?

    Hi,
    The following code provided by Mr. kglad works great in loading an external .swf file onto stage. Now, when I click on Contact (Button), the external .swf file to be removed completely. How to code on contact (Button) to work it out.
    Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
    function GalleryClick(e:Event):void{
    if(currentClip != Gallery_mc){
    currentClip.visible = false;
    Gallery_mc.visible =true;
    currentClip =Gallery_mc;}
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
    loader.load(new URLRequest("Gallery.swf"));
    function ClipLoaded(e:Event):void{
    Gallery_mc.addChild(loader);
    loader.x=0;
    loader.y=120;
    loader.width=1000;
    loader.height=700
    I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
    Contact.addEventListener(MouseEvent.CLICK, ContactClick);
    function ContactClick(e:Event):void{
    if(currentClip != Cotnact_mc){
    currentClip.visible = false;
    Cotnact_mc.visible =true;
    currentClip = Cotnact_mc;
    Gallery_mc.removeChild(loader);}}

    like so:
    Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
    function GalleryClick(e:Event):void{
    if(currentClip != Gallery_mc){
    currentClip.visible = false;
    Gallery_mc.visible =true;
    currentClip =Gallery_mc;}
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
    loader.load(new URLRequest("Gallery.swf"));
    function ClipLoaded(e:Event):void{
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, ClipLoaded);
    Gallery_mc.addChild(loader);
    loader.x=0;
    loader.y=120;
    loader.width=1000;
    loader.height=700
    I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
    Contact.addEventListener(MouseEvent.CLICK, ContactClick);
    function ContactClick(e:Event):void{
    if(currentClip != Cotnact_mc){
    currentClip.visible = false;
    Cotnact_mc.visible =true;
    currentClip = Cotnact_mc;
    if(loader){
    if(loader.stage){
    gallery_mc.removeChild(loader);
    loader.unloadAndStop();  // for fp 10+
    loader=null;  // if loader no longer needed

  • Loading an external swf into my parent swf?

    Does anyone know how I can load an external .swf file into my
    parent file? I have tried to use loader actionscript but think I am
    using the incorrect script or putting it in the wrong place? If
    anyone can tell me the script and where to/how to use it that would
    be amazing? Thanks

    thanks GWD!
    I am using the unloadMovieNum(); command, i have loaded the
    child into level 5 of my parent swf. the parent has multiple scenes
    this one with a layer with a stop(); action and another layer with
    the loadMovieNum("portfolioone.swf", 5); script. it loads the child
    perfectly. The child has a number of pictures in it and a back
    button at the end. I have been adding the
    on (release) {
    unloadMovieNum(5);
    script to the button which unloads the child but stops
    because of the stop action in the first frame of the particular
    scene within the parent. I want to be able to add a script to this
    button which will take me back to a labeled frame in a particular
    scene of the parent, I tried the this.removeMovieClip(); but
    doesn't seem to be working for me, Thanks for the reply, hope you
    can help me further??

  • Unloading external swf file keeps memory usage growing up

    Hello everybody,
    The idea is very simple: I have a submain.swf with 5 buttons. Each button loads an external .swf file.
    com_loader.load(URLRequest);
    After playing first external swf, before I go to next one, I try to unload it:
    1. remove all its associated listeners:
    com_loader.contentLoaderInfo.removeEventListener(Event.INIT-PROGRESS-COMPLETE, idFunction);
    2. unload it:
    com_loader.unload();
    3. set to null:
    com_loader = null;
    and load next external swf file and so on.
    The problem is that the FireFox/IE8.0 Memory Usage in Task Manager is going up and I see no sign of GC activity even after 5 mins of playing. Can anyone light me up pls? This is the second week working around and no good news until now.
    Thanks in advance.
    P.S.
    If I try com_loader.unloadAndStop(); it gives me the error: Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
    Vince.

    Hi Ice,
    The loaded swf file contains only a small photo, just for testing, with no listeners or other stuff in it.
    Vic.

  • What happens when the Main Flash is 25 fps and an external SWF file is 12 fps?

    Hello everyone,
    I have a Main Flash which is set to 25 fps. This Flash is
    used to load an external swf file which was created using 12 fps. I
    would like to know what really happens when the Main Flash loads
    the external swf file? Does the Main file forces the external file
    to be run on 25 fps or the swf file is run with its own 12 fps?
    Any ways, if someone can take the time and explain this, I
    would be greatful.
    Thank you very much and have a great day.
    Khoramdin

    the external swf plays at 25fps - all loaded movies will take
    on the frame rate of the parent movie.
    Chris Georgenes
    Adobe Community Expert
    mudbubble.com
    keyframer.com
    http://tinyurl.com/2urlka
    Khoramdin wrote:
    > Hello everyone,
    >
    > I have a Main Flash which is set to 25 fps. This Flash
    is used to load an
    > external swf file which was created using 12 fps. I
    would like to know what
    > really happens when the Main Flash loads the external
    swf file? Does the Main
    > file forces the external file to be run on 25 fps or the
    swf file is run with
    > its own 12 fps?
    >
    > Any ways, if someone can take the time and explain this,
    I would be greatful.
    >
    > Thank you very much and have a great day.
    >
    > Khoramdin
    >

  • Remove external swf file

    I have loaded an external swf file which plays a flv file by default as swf is loaded. Now the problem is how do i remove the swf file from memory. my code :
        var myLoader:Loader = new Loader();                    
        var url:URLRequest = new URLRequest("ExternalSWF.swf"); 
        myLoader.load(url);                                    
        detailMovieClip.movieHolder.addChild(myLoader);
    I have tried many combinations of removeChild, unload and unloadAndStop but none works. I figure its all about not referencing correctly.

    Hi Jah,
    i understood your problem,i faced this problem many time but couldn't find correct solution.
    I'm using now Event.REMOVED_FROM_STAGE. this method dispatch to parent swf for when the External swf removed from stage.
    The sample example code below for the way of remove externalswf events:
    parent swf actionscript code:
    import flash.events.MouseEvent;
    var myLoader:Loader = new Loader();                   
    var url:URLRequest = new URLRequest("ExternalSWF.swf");
    myLoader.load(url);                                   
    b_mc.addChild(myLoader);
    a_mc.addEventListener(MouseEvent.CLICK,onClick);
    function onClick(event:MouseEvent):void
        a_mc.removeEventListener(MouseEvent.CLICK,onClick);
        myLoader.unload();
        b_mc.removeChild(myLoader);
        myLoader=null;
    ExternalSWF.swf actionscript code:
    import flash.events.Event;
    var num:Number=0;
    addEventListener(Event.ENTER_FRAME,onRun);
    addEventListener(Event.REMOVED_FROM_STAGE,onRemoveFromParent);
    // remove all local events here//
    function onRemoveFromParent(event:Event):void
        trace("remove");
        removeEventListener(Event.ENTER_FRAME,onRun);
    function onRun(event:Event):void
        num++;
        trace(num);
    Thanks/

Maybe you are looking for