Closing swf loaded into movie clip

I have built a movie clip on my main flash file that I am loading separate swfs into. On the separate swfs I have a close button, but do not know what action script to attach to it to make the movie clip go away? I want these to go away every time you hit the close button on the separate Flash swfs loading into the main movie clip.

if the target movieclip has a non-negative depth and the close button is encoded on the loaded swf's main timeline, you can use:
var tl:MovieClip=this;
path.closeBtn.onRelease=function(){
tl.removeMovieClip();

Similar Messages

  • Successfully imported external swf, can not put it into movie clip

    Hello all,
    I have started learning AS3 and gradually getting used to, trying to put external swf into movie clip.
    Successfully imported target swf and put into stage, when I publish this I see target swf is playing.
    import flash.display.MovieClip;
    var BGLoader:Loader = new Loader();
    var BGurl:URLRequest = new URLRequest("HomeBG.swf");
    BGLoader.load(BGurl);
    BGLoader.y = 0;
    BGLoader.x = 0;
    addChild(BGLoader);
    As next step I want to put this swf into movie clip and get more control, but when I publish bellow only I see is empty background, without any errors.
    import flash.display.MovieClip;
    var BGLoader:Loader = new Loader();
    var BGurl:URLRequest = new URLRequest("HomeBG.swf");
    BGLoader.load(BGurl);
    BGLoader.y = 0;
    BGLoader.x = 0;
    //addChild(BGLoader);
    var animMC = MovieClip(BGLoader.content).getChildAt(0) as MovieClip;
    addChild(animMC);
    Is anything missing?
    Any help would be appreciated, thanks.

    You can only access Loader.content after Load completed successfully.
    Try this,
    import flash.events.Event;
    var BGLoader:Loader = new Loader();
    var BGurl:URLRequest = new URLRequest("HomeBG.swf");
    BGLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    BGLoader.load(BGurl);
    BGLoader.y = 0;
    BGLoader.x = 0;
    //addChild(BGLoader);
    var animMC:MovieClip;
    function completeHandler(event:Event)
         animMC = event.currentTarget.content;
         addChild(animMC);

  • Convert Gaphics into Move Clip

    Here, I am create three files. Box.as for making graphich dimentional box, Drag.as is for dragging movieClip and ShowBox.as is to display draggalbe box. I would like to see box with draggable faclity. But I am getting error followig error.
    Description : 1067:Implicit coercion of a value of type Box to an unrelated type flash.display:MovieClip  on Show Box
    Might be I am getting problem of converting into move clip but I am not sure. Would u mind u you gind me in this problem/
    Box.as
    package {
         import flash.geom.*;
        import flash.display.Shape;
         import flash.display.Sprite;
         public class Box extends Sprite {
              public var box:Shape;
              public var boxWidth:Number;
              public var boxHeight:Number;
              public var boxColor:Number;
              public var boxBorderSize:Number;
              public var boxBorderColor:Number;
              public function Box() {
                   //Assign Value
                   boxHeight=100;
                   boxWidth=100;
                   boxColor=0x000000;
                   boxBorderSize=1;
                   boxBorderColor=0xCCCCCC;
                   box=new Shape();
                   box.graphics.lineStyle(boxBorderSize,boxBorderColor);
                   box.graphics.beginFill(boxColor);
                   box.graphics.drawRect(0,0,boxWidth,boxHeight);
                   this.addChild(box);
    Drag.as
    package{
        import flash.events.*;
        import flash.display.Sprite;
        import flash.display.MovieClip;
        public class Drag extends Sprite
            public var clip:MovieClip;
            function dragBox(myClip:MovieClip)
                    clip=myClip;
                    clip=new MovieClip();
                    clip.addEventListener(MouseEvent.MOUSE_DOWN,startMyDrag);
                    clip.addEventListener(MouseEvent.MOUSE_UP,stopMyDrag);
                    addChild(clip);
                    function startMyDrag(evnt:MouseEvent)
                        clip.startDrag();
                    function stopMyDrag(evnt:MouseEvent)
                        clip.stopDrag();
    ShowBox.as
    package{
         import flash.display.Sprite;
         public class ShowBox extends Sprite
              public var myMask:Box;
              public function ShowBox()
                    myMask=new Box();    
                   myMask.boxHeight=100;
                   myMask.boxWidth=100;
                   myMask.boxColor=0x000000;
                   myMask.boxBorderSize=1;
                   myMask.boxBorderColor=0xCCCCCC;
                   addChild(myMask);
                   var myDrag:Drag=new Drag();
                   myDrag.dragBox(myMask);
                   addChild(myDrag);

    I do not understand. Acutally, I want to drag the box . Thus, I want to make it movie clip throug AS. I have made graphic rectangular but could not convert nto movi clip. Is there any function so that I could change my graphic into movie clip .

  • Putting a preloader for a loaded .swf in a Movie Clip

    I am trying to use a preloader for a larger .swf file that loads inside of a movie clip. I was wondering what code might work and where to put it. (preloader is a .swf).  I am using CS4, ActionScript 1.0.  Thanks.

    it does nothing in that context.  so use:
    container._x =-258;
    container._y =-235;
    container.loadMovie("gallery.swf");
    this.onEnterFrame=function(){
    // if you have a textfield with instance name preloaderTF
    preloaderTF.text=Math.round(100*container.getBytesLoaded()/container.getBytesTotal())+"% Loaded";
    if(container.getBytesLoaded()>100&&container.getBytesLoaded()>=container.getBytesTotal()){
    delete this.onEnterFrame;

  • Loading JPGs into Movie Clip

    Can anyone help? I am building a site that requires the user
    to click on a button to change a large JPG image in a movie clip.
    The button is part of a small movie clip that contains a text
    number which is the button in question and a thumbnail of the large
    image. I need the button to play when rolled out (to fade out the
    thumbnail image) and I need the large JPG image to be replaced by
    another large JPG image when the button is released. The button
    instance is "Load Image" and the movie clip I want the new JPG to
    load into is called "Holding Pic". Should I put the action script
    on the main timeline? If so, where? Or should I attach the script
    to the button?
    Many thanks.

    This is an article on AS3 but the answer to your question is
    the same. You can find it in the first few paragraphs.
    http://www.adobe.com/designcenter/flash/articles/flacs3it_astimeline.html

  • Movie not loading into a clip on IE windows

    The following seems to NOT work on IE for windows (xp at
    least) but works on Mac safari, IE Mac, firefox (both systems).
    http://www.jmthiemefinearts.com/jmtFineArts5.html
    Under "Galeries" choose "Video" A video player should load
    into the page.
    thanks for checking it out!

    A coding error was discovered that unloaded the clip right
    after it was loaded. I don't know why Safari & Firefox played
    it anyway.

  • How can I call in swf file to movie clip?

    Hi all ...
    This is my first post for advise, although fairly conversant
    with flash and as2.
    I am developing a new full screen background style website
    and have menu buttons contained within a movie clip (nav_c1) ...
    this re-aligns to the top centre of a page when user scales the
    browser window.
    I then have the content area (centre_content) movie clip ...
    this realigns to the centre of the page when a user scales the
    browser window.
    I have scripted the menu buttons to goto a labelled frame in
    the main timeline but I need, when at the labelled frame, to be
    able to call/load in an external swf file to play 'inside' the
    centre_content movie clip?
    for example:
    If I click my news button the flash file moves to the frame
    label news on the main timeline. This then shows a duplicate of the
    moive clip 'centre_content' which is called 'centre_news'. I need
    to be able to call/load an external news.swf, containing all the
    animated news info, to sit and play 'within' the movie clip
    'centre_news' ... so that it is effectively contained 'within' the
    movie clip file but loaded in place from an external swf file.
    Can anyone help please?
    I can post a rough working example online if need be.
    Many thanks
    A puzzled Adrian
    ps: I don't think I am needing to load the swf to a level 1
    area as I have tried this and instead of the swf file being loaded
    and contained within my movie clip file/area it instead seems to
    sit fixed on the main timeline (ie: not contained within the movie
    clip area).

    Thanks Sketchsta for you code. This looks like we're on the
    right lines as I see what the code is trying to do.
    Unfortunately though I can't seem to get this to work?
    I created a new file to get rid of other scripting that was
    going on and have placed a movie clip called centre_content onto
    the main timeline in frame 1 ... then I have applied your script to
    an actions frame above the movie clip also on frame 1. I change the
    path_to_file line with my swf name (callin.swf) which is a 1 frame
    flash file with some text on it ...
    ... but it doesn't bring in the callin.swf file ... it just
    shows the centre_content clip.
    Am i doing anything wrong?
    I also tried putting the script onto the first frame inside
    the centre_content movie clip but this doesn't appear to work
    either.
    Regarding the pre-loader ... can I simply build this into the
    swf file that is being called in to the movie clip?
    Thanks in advance for your support, it is much appreciated.
    Adrian

  • Loading a movie clip loses my script function

    I have an art gallery that is in three parts. The Flash movie
    used to load everything before opening, but the gallery has grown
    too large. So now I've divided it up into three sections. The first
    section loads the first set of pics with the movie. The second and
    third sections load when you click on the relevant buttons. The
    interface (root movie) has 2 movie clips per section - the
    thumbnails (all three of which load with the movie) and the large
    pics of the thumbnails. So when you click on a thumbnail the proper
    large work shows in the other movie clip. This all worked fine
    using this code in my thumbnails for the largeWorks sections:
    stop();
    large1_btn.onPress = function (){
    _root.largeWorks_mc.gotoAndStop(1);
    large2_btn.onPress = function (){
    _root.largeWorks_mc.gotoAndStop(2);
    etc...
    This code is in the thumbnail movie script. Notice it calls
    _root.largeWorks_mc
    Now when you click on See Large Works button a place holder
    movie clip (target) called largeWorksE_mc is replaced with
    largeWorks_mc.
    The button uses the code:
    loadMovie("largeWorks_mc.swf",_root.largeWorksE_mc);
    But now when I click on the thumbnails nothing happens. My
    thumbnail movie clip is no longer communicating with the loaded
    movie clip. What have I done wrong?

    I had trouble following your explanation.
    If code is disappearing, it is probably code in a MovieClip
    that a loadMovie replaces with another external movie. When using
    loadMovie, the MovieClip in it is destroyed and the timing is not
    something you can predict.

  • SWF loaded into MainNav SWF - Rollovers & Links Don't Work

    Hi all,
    This is probably a very basic question!
    I have a Fla file with Text and Movie clips in it. The Text
    is animated when rollover occurs and thumbnail images click and
    link to the full size versions.
    It works when published (Say "LatestText.SWF").
    But when I call it from my Main Nave FLA/SWF, upon loading
    the Text.SWF, the rollover anim doesn't happen and the picture
    links don't work when clicked.
    I have the latest flash player installed and the actual
    weblink cursor appears as if the SWF acknowledges everything is
    working, but nothing dynamic actually works.
    Any Ideas? THANKS ALL! Much appreciated!

    I'll try to flesh it out, although I don't think there's need
    for any code behaviours as they all work fine - until the info.SWF
    is loaded into the main.SWF.
    So i'll try my best to flesh this out:-
    I have a Navigation FLA which publishes to SWF (at the moment
    Allow access to Local Files - tried network).
    This Nav.FLA is the main bulk of the website, it has all the
    links and window panes.
    I have a downloaded window pane style component which is an
    autoscroller (in case this could be the problem).
    I can load my info.SWF's straight into the container, by way
    of an Actionscript Anim Frame (1) and when the Nav.SWF is tested or
    published, it indeed loads in the smaller info.SWF no problems and
    scrolls around beautifully,
    The Info.SWF's I'm creating is just basically embedded
    dynamic text, with a few movie clips that have Behaviours when
    clicked or rolled-over.
    These Behaviours do not seem to work when the Nav.SWF's
    window pane loads in the Info.SWF - they APPEAR clickable (mouse
    pointer changes to hand) but nothing clicks and THEN works. The
    rollover animations (actioned via behaviours from LABELS - not
    frame numbers) also do not work?
    Any ideas from those that know to those that struggle would
    be greatly appreciated! It's the first time I've encountered a
    problem with my Flash website that I can't seem to find an answer
    to in all my tutorials and books!
    There's a challenge!

  • Need help loading multiple movie clips.

    Hello forum members,
    I've run into a bit of an irritating problem and perhaps
    someone can clue me in to the answer.
    I'm creating a SWF which uses loadMovie (I've also tried
    creating a MovieClipLoader instance and using instance.loadClip) to
    bring in 2 other SWFs.
    See below AS in first couple frames of main movie's
    time-line:
    First movie:
    this.createEmptyMovieClip("mcToolbar", 10);
    with (mcToolbar)
    _x=8;
    _y=68;
    loadMovie("toolbar.swf",mcToolbar);
    Second movie:
    this.createEmptyMovieClip("mcWindow", 11);
    with (mcToolbar)
    _x=500;
    _y=60;
    loadMovie("textwindow.swf",mcWindow);
    This works great when opening up my main SWF in Flash Player
    and when viewing the movie in the published HTML web page.
    However, I'm using FlashObject to load my main movie to get
    around that annoying "Click to activate this control" thing.
    When viewing this version of the web page with my main SWF
    being loaded, I see the SWF load, then the first loadMovie
    loads....THEN the first loadMovie disappears and the second
    loadMovie loads and appears at the wrong X and Y coordinates.
    Any ideas?

    Ok, I know replying to my own post is odd on some forums, but
    anyhow:
    I've done some further testing and find that FlashObject
    isn't the problem.
    Looking at the AS code above, it is clear that the SWFs to be
    loaded must be in the same folder as the HTML web-page.
    However, my intent is that these small SWFs that are being
    loaded in by the main SWF will be shared by many other movies,
    therefore I'd like to stick them (the physical SWF files) closer to
    the root of the site (e.g. SiteFoler->flash).
    I see that my problem rears its ugly head when I try to
    reference these movies in my main flash movie as follows:
    First movie:
    this.createEmptyMovieClip("mcToolbar", 10);
    with (mcToolbar)
    _x=8;
    _y=68;
    loadMovie("../../../flash/toolbar.swf",mcToolbar);
    Second movie:
    this.createEmptyMovieClip("mcWindow", 11);
    with (mcToolbar)
    _x=500;
    _y=60;
    loadMovie("../../../flash/textwindow.swf",mcWindow);
    In the example above, my HTML page is 3 folders deep whereas
    the movies I'm loading in are 1 folder deep in the folder labeled
    "flash".
    By doing it in this manner, I get the problems I described
    above (first movie loads then disappears and second movie loads in
    wrong position).
    Any ideas as to why the physical location of the SWFs being
    pulled in is causing this problem? I'd like to try to avoid copying
    the SWFs to each place their being refrenced from as that could be
    a major maintenance headace.
    Thanks,
    Ben

  • 'Load external movie clip' behavior

    I am currently working on a flash movie that loads with an
    animation and stops to show four buttons that are then supposed to
    load external .swf files when clicked (released). While the
    behaviors and actions I have set all work fine when I test the
    movie in Flash, when all the files are uploaded to my server, the
    external movie clip does not load, and the message in the bottom
    left corner of the browser hangs at waiting for
    www.panoramalotforsale.com...
    Anybody any idea what I'm doing wrong?

    When everything works fine locally, but fails to load live on
    your webserver, there is of course a pathing problem.
    So, in your flash, when you call loadMovie, try using a full
    path to the external file your trying to load.
    So for example, instead of "/movies'/myexample.swf", do "
    http://www.yoursite.com/movies/myexample.swf".
    Make sure you keep the
    http:// though.

  • Loading a movie clip to Flash

    I have a huge movie clip to be imported, its pretty huge so I
    divided them to smaller pieces and tried to import, everything my
    PC gets hung and does not respond after import. What is the best
    method to import a single huge movie clip? Your help is
    appreciated.

    Problem Solved.
    To everyone that has experienced some version of this issue,
    whether it be in previewing a load progress bar, or having
    animation freeze on you while loading external movie files...
    In test mode in flash, whether you are doing a simple test
    movie or debugging, loading progress appears to not be threaded and
    will freeze you movie until the load is complete. if you preview
    this movie clip in a browser after publishing it, everything should
    look ok.
    I've read a lot of posts about this same topic. Macromedia
    (or shall i say Adobe), fix this issue in your next release. what a
    pain...seriously. debugging is useless if the movie doesn't even
    run the same.
    very much relieved,
    Al.

  • SWFs containing 3d movie clips do not display correctly

    I'm having difficulty using a swf with a 3d movie clip, it's displaying much larger in captivate than it does in any other context.  Are there known issues with 3d clips in captivate?

    Hi GCemb,
    Thank you for contacting Adobe Support.
    Can you please and insert an .mp4 3D video clip using though Event video option in Adobe Captivate.
    We tested the same at our end and the video is working fine.
    Thanks
    l.oveesh

  • This.stage in a SWF loaded into Flex

    I'm running into an issue where I have a SWF created in Flash that adjusts its size according to parameters using Stage.scaleMode = StageScaleMode.NO_SCALE and Stage.align = StageAlign.TOP_LEFT, but for some reason the reference to this.stage is lost when its loaded into Flex. In Flex, I receive an error for Cannot access property or method of a null object reference. Is there some conflict with this.stage inside of Flex?
    Thanks,
    Michael

    Make sure you are accessing this.stage property late enough during the initialization of your application.
    For instance, if you've got an application event trigger a call to an init() function, make sure the trigger is applicationComplete and not creationComplete.
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
       applicationComplete="init()">
    In order to access an application's stage property, to add an event listener for instance, you'll need to make use of the applicationComplete event. This event is triggered a little later in the application initialization process.
    Let me know if that does/not help.
    Ben Edwards

  • Load all movie clips

    Hi,
    I have a "map_mc" movie clip that has over 500 movie clips(counties). I also have the countynames in xml format.  I want to be able to
    1.  in a loop get a list of all movie clips
    2. and in a dynamic text box assign the county name to the movie clip (from xml).
    Is it possible to get the names of all movie clips and then assign the countynames?
    I have the xml part semi working and on mouseover can display the name but is stuck on the movie clip part.
    I am trying to avoid typing all the county names  and in the future will be adding census and other data to the xml.
    can someone help?

    if you had an xmlList of 500 countynames, and if the 500 movieclips inside maps_mc each had names such as mc0, mc1, mc2, etc, you could loop thru them like this:
    for(var i = 0; i < xmlList.length(); i++){
         //get reference to county movieclip
         var mc = maps_mc.getChildByName("mc" + i);
         //then add listeners
         mc.addEventListener(MouseEvent.ROLL_OVER, overMe);
         mc.addEventListener(MouseEvent.ROLL_OUT, outMe);
    function overMe(e:MouseEvent){
         //the county you rolled over
         var mc = e.target;
         //extract the number from the name
         var n = Number(mc.name.substr(2));
         //use n to get countyname from xmlList
         var countyname = xmlList[n];
         trace(countyname);
         //now add countyname to a textField
         textField.text = countryname;
    function outMe(e:MouseEvent){
         //clear textField
         textField.text = "";

Maybe you are looking for