Loading movies with AS3

I'm trying to understand how works AS3 than AS2 when using the navigation buttons to load external .swf files.

In AS2, I have 5 menu buttons. Each button contained a script to load an external .swf file into layer 2 (on top of my existing film). It also contains a line of code to unload a movie that was already in layer 2. This way new movies arrived head and are easy to identify when it came time for them to be discharged.

Now in AS3, I can't find a similar way to work with external movies, since there is no more layers. I create a movieLoader and add a child so it loads my external .swf - that works very well.

But how can I say each button to remove all children already exist before loading the new child? The way it works now, the movies just keep stilts above the other whenever I click on a button.

Here is the code that I put with each key, activated by a mouse event listener. "requested_movie_name" would be different for each button.

var movieRequest:URLRequest = new URLRequest ("' requested_movie-name.swf" ");

var movieLoader:Loader = new Loader ();

movieLoader.load (movieRequest);

addChild (movieLoader);

Thanks for any help

You do not need to identify what film to unload, a charger can contain only a single child display both object.  To unload the loader for the code you showed that you would simply use...

movieLoader.unload ();

Because you load swf files, you should look through the help documentation for the Loader class and the unload method because it has a few special remarks that might help your scenario.

Tags: Adobe Animate

Similar Questions

  • A simple way to load a pdf page into flash with as3

    Hallo,

    is there a simple way to load a pdf page into flash with as3 at Flash.

    I mean no plug in or as a class.

    Thank you.

    If it is an air application, you can use the htmlLoader.

    Otherwise, you can use navigateToURL but that only opens 'in' your swf, and you cannot manipulate the PDF with actionscript.

  • Adjust the order of the layers with AS3

    I want to load an external SWF into my project. I do this by adding a charger to the scene. It seems above all, there are 16 layers in my FLA, and I want to put it between the second and the third to the lower layers. How can I do this? I looked at some things online but they are all to change the order of objects on the same layer, and they usually invole do 2 or three objects with AS3 then change the order on the same layer, always above the objects that are actually on the stage of the FLA. I want to put the SWF loaded under Of OBJECTS ALREADY EXISTING that are on different layers.

    My code:

    var pageLoader:Loader = new Loader;

    addChild (pageLoader);

    pageLoader.x = 98;

    pageLoader.y = 121;

    pageLoader.z <-as far as I know it works in a single layer, it won't jump from layer to layer.

    Some have suggested to load my swf in a clip from movie ampty bt when I do this I lose interactivity for swf file, why is this and is there away around this?

    My code:

    var pageLoader:Loader = new Loader;

    pageContainer.addChild (pageLoader);

    pageContainer is an empty movie clip

    I want to load directly to the scene and just change the layer (first method), but if this cannot be done so I need a way to get SWFs loaded into a clip vacuum film and keep their own interactive.

    I dound in connection addChildAt, which is different from addChild, because it has 2 parameters, the name of the object and its z-index. So I was able to do:

    addChildAt(pageLoader,4);

    Then I met the same problem with movie clip method is empty, I lost interactivity. Then I noticed that there movieclips above because one of them is used as a blending mode by covering it. So, I realized that the empty movie clip method did not work because there are video clips above it. So I did mouseEnabled = false. And it works, so YAY!

  • Problem with AS3 &amp; quot; ExternalInterface.call("saveglobalscore",score) &amp; quot; in Internet Explorer

    Hello

    Explain how the page is set up:

    I have a HTML page with 2 different movies Flash AS3.

    The first flash movie is the main entertainment and is located in the middle of the screen with a large background image defined in the body of the HTML.

    The second flash movie spans 100% width/height of the size of the screen and acts as a black fade > invisible.

    What I'm doing:

    Once the second Flash animation has gone from black to invisible it calls a JavaScript function on the HTML page to hide the div element, the second flash movie is integrate in (it's like the first flash movie displays a set of input boxes, which the user must be able to type-which will not be able to click on if there is another flash animation that just overlap the first film).

    My initial solution:

    In the second Flash movie is the following code:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Stop();

    This will load the API needed to communicate with external entities
    to import flash.external.ExternalInterface;

    call the JavaScript function
    ExternalInterface.call("saveglobalscore",score) ('myJavaScriptFunction');
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    .. .and it works fine in Mozilla Firefox/Safari. The actionscript code successfully the JavaScript function in the HTML page and this JavaScript function simply calls (to this poster from the scene an alert() message to show that it has been called successfully).

    Problem with IE:

    But, at the time when I try this in Internet Explorer, I get an alert() message but a JavaScript error message that says:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Code: Select all
    Line: 1
    Char: 106
    Error: 'null' is null or not an object
    Code: 0
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    As you would expect I am totally confused as to what could be the problem.

    It's really urgent because it is a living project which must be completed immediately, any help you might have would be greatly appreciated!

    Kind regards

    Select this option.

    GWD salvation,

    Who did it! :)

    I applied the attribute id = "fTrans" to the tag and IE worked well.

    I disparage me my brain one, thank you very much!

    Kind regards
    Mark

  • Parental and child control with AS3

    Hello

    I am new to AS3 and although I can see some good practices and functionality, I'm constantly stuck and can still do the things I would do if easily with AS2 - I almost it relearn from scratch!. I would still appreciate little help and advice on this...

    I did a class that creates a "sort" menu with data from an XML file, and basically is what he does when he is called to create an emptyMC (a container), add a childMC (a square) and add another child (a text label). When I create the container, I am trying to add a MouseEvent that can act on each instance of container, but all I can get is a MouseEvent on the object that contains all the MCs added. The code follows.

    Can someone enlight me with that issue or explain what I am doing wrong.

    I do not understand the parental dynamics with AS3 and the absence of the use of instance names and parenting dot does not help.

    Thanks in advance.

    Note to Adobe: previous versions of Flash and as a reference Help files were far more useful than in CS4!

    In the timeline:

    Import assets.myDynMenu;

    var theMenu:myDynMenu = new myDynMenu ("menu.xml");
    stage.addChild (theMenu)

    Stop();

    In the class:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML
    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; I < xml.menuData.menuItem.length (); i ++) {}

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mConfig.mainIt emH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }

    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
    trace ("you're on" + myIdName);
    }


    }

    }

    use:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML


    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; i)

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mCon fig.mainItemH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }
      
    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
             trace ("you're on" + event.currentTarget.name);
    }

    }

    }

  • load swf AS2 AS3 swf problem

    I have a flash with AS3 and inside the swf I load in an AS2 swf file.

    to load a swf works fine, but the problem is when I load it in that I want to go

    a specific part of it, for example, I want to go to frame 3 in the loaded swf file.

    I need to check this in the AS3 swf, does anyone know if this is possible?

    Thanks in advance

    Yes, it is possible.  Use the localconnection class to communicate between the two rulers.

  • images don't "move with the text" correctly when I have several columns

    I use 2 columns, have been inserting images in my text and chose 'move with the text' but when I have to go back and fix something, or add text over the images all move and do not stay with the text.  They start on their knees and move to the other columns and will not stay with the text.  In my view, this has to do with the use of columns, does anyone have any suggestions?

    What version explicit pages (Pages: pages) and the Apple logo: about this Mac) operating system version are you using? There are different, a functional version of the Pages that are running on the current releases of OS X and guessing will not help you.

  • Stay on the Page/move with text/pull on my hair

    Dear friends,

    I asked this question before and yet I'm still terrible problems with my graphics flies over the text document when I add more text.  I'm not able to find the archives with the answers that people have written to me.

    I need to write a series of laboratory reports and using a terrible time amount to try to put the images in place. I do not receive a flow of text running.  Even in sections that I created, some of the images floated back up to the top of the section and are sitting there tight.  I am not able to move.

    Here is an example of a problem: I inserted a scatterplot and written my text.  I click on the tab "move with the text."  The Text wrap tab chooses spontaneously "Inline with the text.  My plot is moved to the left column - but I don't want that here.  I need to add a small annotation.  I'm not able to merge the plot toward the Center where the function of "In line with text" does not allow this.

    Basically, I try and change all the figures and plots to "Move with the text", but they tend to change to 'Stay on the Page' when I look away.

    Now, I wonder if I shouldn't open a new document in layout? This way I can add all my numbers for the section of the results in place holders.  But what I can combine "Text Layout" sections "Page Layout"?

    I really want to go back to Microsoft Word.  I would like to become proficient with Pages - and of course to learn my lab equipment!

    5.6.2 pages

    OS X El Capitan

    MacBook Air

    Thank you for your attention.

    Jonelle

    Today, I opened my document to

    Jonelle,

    Each object, with the exception of a table when it is inserted in a document of v5.6.2 Pages, has its object set to Move with text placement and its set to automatic text wrapping. To keep your images of richocheting around your document out of your control, or push a the other, visit the reorganize with the selected image tab and change skin to zero. Now you can place pictures anywhere in your body text.

    Unlike Word, Pages v5.6.2 doesn't have a convenient annotation tool, and we need to position and an oblong text box that contains the annotation group - under the image.

  • Make a movie with clips of 1080 and 4 k sources

    Hi all

    If I do a movie with clips of 1080 p sources (like my iPhone 6) and 4 k sources (like my GoPro) I'll still be able to export the animation to quality 4 k? Is there something specific I need to do to keep export k 4 option in iMovie available i.e. the order I add clips in the project, etc.? Will be 1080 p "blasts upward" clips at 4 k resolution?

    Thank you for your help.

    Miles

    10.1.2 iMovie will use the size of the first element that you add to your project to determine the format of the exported movie.

    See Help: http://help.apple.com/imovie/mac/10.1/#/move6ccb3330

    The resolution and the frame rate of your movie project are determined by the first clip you add to the timeline. iMovie now supports 4 K video and image rates at 30 frames per second (fps). If you want your project to be set at 4K resolution, the first clip you add to the timeline should be a clip of 4K. If you want your project to be set to 60 fps, the first clip you add to the timeline should be a clip of 60 frames per second.

  • When playing the movie with apple tv

    When I play movie with apple TV into TV movie is slow but in mac book or I touch all is good.

    I have apple 32GB (new) TV and Airport Express .all concretion is WIFI

    Help

    What is exactly slow, are you using AirPlay.

  • can I combine my Apple Tv bought movies with my private collection

    Can I combine my Apple TV bought movies, with my private collection? If so, how can I go about it. Thank you

    Ted

    No you can't combine movies Apple purchased with your "private collection" if they were movies home DVD "tears" or bought from another supplier (for example, Microsoft, Disney, VUDU, etc..)

  • How to organize a table like 'move with the text' and 'around and underneath "? For now, my only option in the menu drop-down is "in line with text.

    Hello. I am trying to format a table, so that when I hit it, it moves to the bottom of the page and the bumps any text underneath down as well (that is if you can see the whole table and all text at any time)

    .

    However, the only options I seem to have are moving with the text > inline with the text. The first part is what I want, but having the means of inline with the text of table than all text below it floats UNDER the table, and you can't read it.

    PIC 1 - My only option when "move with the text" is selected. As you can see all the other features are also grayed out.

    Photo 2 - I want now, select above and below, but when I select something other that in line with the text...

    PIC 3... it jumps to stay on the Page option is not what I want.

    Any ideas?

    You can have a floating table in v4.3 Pages ' 09 that moves before the text typed before it, but this feature has not been added to any release of v5 Pages. Simply set the table in the Wrap Pages ' 09 Inline with the text Inspector, and object causes the film if you wish.

  • Table: "move with the text -" option restores the "stay on the page.

    I'm under Pages 5.6.1 on MacBook Pro (15-inch, mid-2015, retina, 10.11.3).) 2.8 i7 1 TB flash, 16 GB 1600 MHz DDR3, GHz Intel Core.

    The question that I will have (and frankly, have frequently), it is that when I have a table or an image embedded in a Pages document, I have problems affecting this table or an image to "move with the text" Format--> arranges--> object--> move with text placement, inevitably the option 'dressing' going on to "in line with text." But I don't want "inline with the text" option is selected, I want the text to wrap around the image. After scouring the other threads, I found the idea that it has to do with the provision of two-sided objects, and that the image or table should be sent to the front to make it possible. However, these options are completely grayed out during this effort together.

    Anything you can do to help would be appreciated, Internet.

    The Baron

    I'm under v5.6.1 Pages on 10.11.3. Table and image in the screenshot below have wrapping of text around the value and purpose of investment for both is stay on the Page. Get a text wrapping. Is this your goal of flow?

  • control of Instruments of California 3091LD load Programmable with LabVIEW

    I need to check a California Instruments programmable load 3091LD with LabVIEW. It will be connected with GPIB. Can anyone provide me with the help on this please? It will be very appreciated if someone could give some example for the device codes.

    Thank you.

    Hello Niyam,

    I found directly a driver for LabVIEW Instrument for this specific instrument, but there are some other devices of California Instruments for:

    http://search.NI.com/nisearch/app/main/p/bot/no/AP/tech/lang/NL/PG/1/SN/ssnav:IDR/q/California%20ins...

    Beside that, I also found this page on their Web site:

    http://www.acdcelectronicloads.com/products/3091LD/3091LD_Downloads.htm

    Here, they do not mention a LabVIEW driver, but they have a driver of the CVI.

    Do you find yourself however the manual there, which may be useful to evry.

    Can you check with the manufacturer (California Instruments) if they have a Driver of Instrument LabVIEW?

    Beside that, it would also be a good idea (totally) go through this tutorial of LabVIEW:
    http://www.NI.com/gettingstarted/labviewbasics/

    This should teach you a few basics in LabVIEW.

  • Help! I did a movie with pictures on Movie Maker, played very well. Now, it's just to show Xs red in the photos of some, but not all. What I am doing wrong?

    I did a movie with pictures on Movie Maker and played very well.  Now, it's just to show Xs red in the photos of some, but not all.  What I am doing wrong?

    When you save your project, and then rename, move or delete a photo next time you open your project, you will see a red X where the photo was. Just a click with the right button on the X and select Remove then import your photo again under the new name or location and click on save project on the file menu.

    In the menu task under finished film click Save to my computer tracking instructions and your project will be saved as a movie.

Maybe you are looking for

  • Satellite Pro L500-1W4: win 8 cannot turn on WiFi

    Hello I installed 8 64-bit Windows on my Toshiba Satellite Pro PSLSAE L500-1W4Previously, I had Windows 7 64-bit on After the installation of Windows 8, I am unable to turn the WiFi on my PCBut the driver for my wireless card (WLAN 802.11n Realtek RT

  • Qosmio F50 - 125 Local network sharing problem

    Hello Recently I installed windows 7 and downloaded all the necessary drivers for my computer toshiba laptop. The problem is that I can't access the computers in my home network and others cannot see my computer. I am connected to the network with a

  • Adding keyboard shortcuts

    Is it possible to create a keyboard shortcut for the menu of the application that has submenus?  E example for the file menu of Pages command export to PDF (submenu)...  It doesn't seem to work.

  • How to synchronize or trigger OR-DAQmx devices in LabView

    I'm using LabView 2009 with a cDAQ-9174 chassis which includes an NI 9263 analog peripheral and an NI 9222 analog input device. I learned in the examples that I can synchronize the devices at the same sample rate. But I'm looking to sync devices such

  • Update works not for several months.

    Update of Windows Vista has stopped working.  All attempts to auto since Nov 09 failed.  I get the download screen, but it still just hung to "0-downloaded" until it times out.  I tried to reset components to update using Mr. Fixit, but get the error