Loading external SWF's into an SWF Loader as3 style?

Hi,
I've recently made the switch from as2 to as3 and am still struggling to get my head around one aspect in particular. I've managed to load one external swf into a blank file via the script
import LoadDisplayObject;
var loader:LoadDisplayObject = new LoadDisplayObject("button_01.swf", true);
loader.addEventListener("displayObjectLoaded", onComplete, false, 0, true);
addChild(loader);
function onComplete(evt:Event):void {
     trace("loaded complete received");
     loader.scaleX = loader.scaleY = .75;
.....however I'm struggling with the script to make a swfs load into a space when one of my 3 buttons is clicked....
My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate swfs with the same names which I wish to load in, when the appropriate button is pressed. 
I have managed to get them to load in using a tutorial...however they load over the top of each over...far from ideal. From research on the internet I've found a range of different script...but I just can’t find anywhere I can find script to make this work..hence why I have turned to here.
Any help much appreciated...thanks in advance.

Hi,
Just throught I would let you know that I've manged to get this to work this morning. Changed the script slightly and used a different method of:
var home:MovieClip = this;
function butt1Click(evt:MouseEvent):void {
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest("button_01.swf"));
    ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function butt2Click(evt:MouseEvent):void {
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest("button_02.swf"));
    ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function butt3Click(evt:MouseEvent):void {
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest("button_03.swf"));
    ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function loaded(evt: Event):void {
    if(contentClip.numChildren > 0){
        contentClip.removeChildAt(0);
    contentClip.addChild(evt.target.content);
button_01.addEventListener(MouseEvent.MOUSE_UP, butt1Click);
button_02.addEventListener(MouseEvent.MOUSE_UP, butt2Click);
button_03.addEventListener(MouseEvent.MOUSE_UP, butt3Click);
seems to work well. Only small question is if I want one page to load automatically upon opening...how do I alter the script to do this??? Thanks

Similar Messages

  • Load external swf thats AS3 in a AS2 swf

    i have a website made in actionscript 2, and now i need some
    functions from actionscript3 that actionscript 2 doesnt have, so im
    trying to load a external actionscript 3 swf in to a actionscript 2
    swf, is this possible?
    im using _root.mc.loadMovie("ms.swf");
    cuz it doesnt seem to work

    ah ok thanks
    have any idea how to load text into swf in AS2.0 without
    having a tag like text= ... because as far as i know only AS3's
    URLLoader can do it.

  • Positioning External SWF in Flash

    I'm having a lot of trouble doing a simple positioning of an
    external SWF with AS3. I have a timeline animation that this
    external file plays in. It works but I can't get it to play in the
    right position.
    Thanks for any help you can give!
    The code I'm using is as follows. I tried:
    thisLoader.x = 500
    thisLoader.y = 500
    but it has no effect...

    I add the loader to the stage and it works fine. There is
    nothing in the
    docs about needing to create a movie clip first. --Tony
    "Joergen N" <[email protected]> wrote in
    message
    news:g7h8qm$9n4$[email protected]..
    > You positions thisLoader with thisLoader.x= etc, but you
    don't add
    > thisLoader to the stage. You only add thisMovieClip to
    the stage, so try
    > something like thisMovieClip.x= etc.
    >

  • Positioninig External SWF in Flash

    I'm having a lot of trouble doing a simple positioning of an
    external SWF with AS3. I have a timeline animation that this
    external file plays in. It works but I can't get it to play in the
    right position.
    Thanks for any help you can give!
    The code I'm using is as follows. I tried:
    thisLoader.x = 500
    thisLoader.y = 500
    but it has no effect...

    I add the loader to the stage and it works fine. There is
    nothing in the
    docs about needing to create a movie clip first. --Tony
    "Joergen N" <[email protected]> wrote in
    message
    news:g7h8qm$9n4$[email protected]..
    > You positions thisLoader with thisLoader.x= etc, but you
    don't add
    > thisLoader to the stage. You only add thisMovieClip to
    the stage, so try
    > something like thisMovieClip.x= etc.
    >

  • How can I load an external SWF into a movie clip that's inside other movie clip?

    Hi.
    I creating my first flash (actionscript 3.0) website but I'm
    stuck with a visual effect I want to create.
    I have a window on my website called contentWindow. Every
    time you click a button this window is supposed to leave the stage,
    load the requested content and return to the stage.
    The sliding window is a movie clip with 83 frames, 21 to
    enter the stage, 21 to leave the stage again, 20 for nothing (its
    just to simulate the loading time) and 21 to return to the stage.
    Now my goal is, when the user clicks on a navigation button,
    the window exits the stage, loads an external SWF with the content,
    and then returns to the stage.
    I've the "window" movie clip with an instance name of
    "contentWindow". Inside there is another movie clip with an
    instance name of "contentLoader". The content that the user
    requested should appear inside the "contentLoader".
    Now, when the contentWindow leaves the stage, I get this
    error message:
    quote:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at rwd_fla::MainTimeline/trigger()
    If I switch
    "contentWindow.contentLoader.addChild(navLoader);" for
    "contentWindow.addChild(navLoader);" it works fine, but the
    external SWF doesn't move with the window.
    How can I load an external SWF into a movie clip that's
    inside other movie clip?

    Hi,
    Recently, I have been putting together a flash presentation.
    And I am just wondering if the following might help you, in your
    communication with the said swf file:
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    function onComplete(event:Event):void
    event.target.content.thinggy_mc.y -= 100;
    Not the best example, but this allows you to target a mc
    within an external swf file. I think if you look up this code, you
    will have an answer ;)
    Kind Regards,
    Boxing Boom

  • 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...

  • Is it possible to Load External SWF files into Flex Mobile projects?

    Hi Guys,
    I'm trying to load an external asset in this cse (a SWF file) into my flex project (Apple IOS IPAD), don't get any luck. Can any one suggest a solution ?

    In Apple's words, "No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple's Documented APIs and built-in interpreter(s)".
    Hence external swfs cannot be loaded in iOS.

  • Trouble loading external .SWF into my main page with preloaders

    Dear All,
    I am working on my first Flash project with AS3.
    The structure of the flash site is pretty simple. I have a
    stage 1165px wide x 710px height
    Inside my Stage I have an horizontal bar with a menu followed
    by a container right under.
    **** My goal
    is that whenever I click on one of the button on the menu, that the
    related external .SWF loads into
    the container with a preloading bar and %. *****
    I already did all my .SWF files and it is pretty frustrating
    at this point to be stuck at this point of development.
    Please help.
    -Alex

    Visit gotoandlearn.com. There is a video tutorial there
    regarding preloading that should answer most, if not all, of your
    wonderings.

  • 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??

  • Loading an external .swf into an empty container

    I'm loading an external .swf into an empty container.
    Everything seems to work fine except when the .swf is loaded both
    seems to be running extremely sluggish. The button rollovers are
    slow, the page transitions..everything. I can't figure out why it
    is doing this. Both .fla's have the same frame rate. Is there some
    known reason why this might happen?

    well, we've tried that and it is actually a little bit worse.
    Normally i test everything in a browser window anyway. I'm thinking
    it might be a naming issue of some variable or something that is
    the same for both fla's....not sure yet though.

  • Load external swf into existing mc

    I think this is very old question,
    in as2 you can just add a external swf inside a mc.  like this -  loadMovie ("example.swf", "_root.mc");  and that's it.
    how do i do that in as3? this following doesn't work..
    var newLoader:Loader = new Loader();
    function loadMc(evt:MouseEvent) {
        var request:URLRequest = new URLRequest("example.swf");
        newLoader.load(request);
        addChild(mc.newLoader);
    can I go remove mc first, and then add the swf as mc again?
    removeChild(mc);
    addChild(mc);

    Hi, moccamaximum,
    thank  you, going to test-fail-test for a while with this.
    meanwhile Im gonna ask ahead another thing
    Hi kglad, you gave me the source file for jpegTest yesterday, I tested it work like charm,
    now you have these,
    import JPEGEncoder;
    var bmpd:BitmapData=new BitmapData(mc.width,mc.height);
    bmpd.draw(mc);
    var jpegEnc:JPEGEncoder =  new JPEGEncoder(75);
    var jpegDat:ByteArray = jpegEnc.encode(bmpd);
    then in function localSave it send jpegDat to php for generating the jpeg.
    I want to pack these into calling function, so after example.swf loaded into mc, can call the function so the jpegDat will have the data of example.swf and generate the jpeg from it? 
    jpgDatGenerate('mc');
    function jpgDatGenerate (target) {
    var bmpd:BitmapData=new BitmapData(target.width,target.height);
    bmpd.draw(target);
    var jpegEnc:JPEGEncoder =  new JPEGEncoder(75);
    var jpegDat:ByteArray = jpegEnc.encode(bmpd);
    obviously something wrong, it gives me something about jpegDat not defined at localSave
    what have I missed?

  • How to detect the end of an external swf loaded into a container

    Hi,
    I'm having trouble finding a solution for this problem, can somebody help me?
    I have a main swf that will load external swfs into a container. I need to detect the end of the loaded external swf in order to start to load and play a new one into the same container.
    The problem is that i do not know what the length of the external swfs will be, and will have no control over the development of them, so i cannot place a variable at the end of their animation which would allow me to detect from the main movie its end.
    I also cannot rely on the _totalFrames property because the loaded swf might not have all the animation inside its main timeline.
    Is there any way to achieve this goal?
    Thx

    Ok... Its as i thought... unfortunatly...
    Gonna mark your latest post again as possible solution, just in case someone comes with any sort of out of the box thing...
    Thx for your help Kglad

  • Load external swf into a specific _level

    Hi there,
    I am loading an external swf into the mc 'image' using:
    image.loadMovieNum("portfolio/100_design/1.swf", 1);
    Every time a new image loads, I want it to load the level above, ie:
    image.loadMovieNum("portfolio/100_design/1.swf", 2);
    Is there a way this can be done dynamically. For example, "current level + 1"
    Many thanks

    is the first frame of your loaded swf's empty?  if yes, then no problem using _levels.
    if not, do you mind a momentary flash when your next swf loads and before its _alpha is assigned 0 and then faded-in?  if you don't mind, then no problem using _levels.
    if you do mind that momentary flash, then using _levels will be more complex than using empty target movieclips.  is there some good reason to use _levels instead of target movieclips?

  • Error 2044 when loading external swf into my site

    Ok what i have is a site made from 1 flash file where i am loading external swf files for my picture galleries. now what is happening is in Flash, dreamweaver and when i test the site, everything is working perfectly, the problem is coming when i go into internet explorer go to the site and click on the flash button to go to the picture gallery, that is when it is giving me a Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
    does anyone know why this is happening and a possible way to fix it? thanks

    See if the following link helps at all...
    http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=20453

  • Load external image & text into SWF

    Can someone point me to a tutorial on how to create a
    template that will load an external image file,.css styled text
    & a .css style sheet into a .swf by using .xml?
    Thank you for your time.
    CK

    You can use the MovieClipLoader class to load multiple images sequentially (one at a time), but you wouldn't use a 'for' type of loop...instead you would use a recursive loop, where a loading function is called after each load completion until all loading in done.  This is done by utilizing a load-complete listener to trigger loading of the next image.  So you start the loading process by loading one file, when that file is determined to be loaded, the listener proceses that file in whatever way you need to prepared (resizing, etc) and triggers the loading of the next file.
    If you look up the MovieClipLoader.addListener method in the Flash help documents there is an example there that uses the onLoadInit event.  You would be wanting to use the onLoadComplete event.

Maybe you are looking for

  • Image Maps not working in Firefox or IE

    For some reason my Golive 9 submenu image maps (News, Locations, etc.) work in Safari, but not in Firefox or IE. Plus some elements seem scrambled in the two latter browser apps. Here's the web page: http://www.frankparsons.com/express/index.html Why

  • Write to file(AVI) synchronizate data

    I receive a USB Camera signal and a CAN(Control Area Network) signal. I like two signal parallel displaying and write to file (one or more) and after read. I practise IMAQ AVI Write Frame.vi with DATA. I receive USB Camera signal around 15fps (but th

  • Error InfoObjeto 0COMPANY

    I'm having a problem when performing full load, giving this error. Look at the error message: Diagnosis                                                                                It has been verified if the value of InfoObjeto is charged accordin

  • Control indicators for controlling area donot exist"

    I have created one po order for which I am getting the error as"control indicators for controlling area donot exist" Can some body tell me me how to solve ths issue and wt settings needs to be done in IMG Regards Chitra

  • Correlation - Expiration of Receiving Step

    Dear all, In our scenario, the ccBPM integration process needs to send an asynchronous messge to an external service provider and wait for some time to get the response. If e.g. 2 days passed without response received, the integration process has to