External swf button to move main timeline

Hi,
i made a main(parent) page that loads an swf which has a button(a1) which on click i need it to move the timeline of the parent
i wrote this code to the external swf and tryed many commands such as Object(root).gotoAndStop(1);
a1.buttonMode = true;
a1.addEventListener (MouseEvent.MOUSE_UP,a1a);
function a1a(event:MouseEvent):void {
what do i need to write inside to make it work?
Thanks in advance

try this:
a1.buttonMode = true;
a1.addEventListener (MouseEvent.MOUSE_UP,a1a);
function a1a(event:MouseEvent):void {
trace(a1.parent.parent.parent);
trace(a1.parent.parent);
//  find the right timeline , maybe with more parent.parent.... and then:
MovieClip(a1.parent.parent.parent).gotoAndtop(10);

Similar Messages

  • 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

  • Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?

    I have a buttons that play to symbols on the timeline. Once another button is clicked on the timeline the symbol will playout then start playing the next symbol. This is the code used on the onClick event on the introduction button.
    var current = sym.getVariable("current");
       if (current != "") {
          sym.getSymbol(current).play("out");
          sym.getSymbol("intro").play("in");
       else {
          sym.getSymbol("intro").play("shortIn");
       sym.setVariable("current", "intro");
    The problem I'm having is with the technology symbol. I have buttons within this symbol that link to other symbols. I would like these symbols to playout like the other buttons, but the content of the symbol stays on the stage and does not play out when I select a button on the Stage. Here is the code I have on the click event on the button within the symbol.
    var current2 = sym.getVariable("current2");
       if (current2 != "") {
          sym.getSymbol(current2).play("out");
          sym.getSymbol("optical1").play("in");
       else {
          sym.getSymbol("optical1").play("shortIn");
       sym.setVariable("current2", "optical1");
    Any help would be greatly appreciated. Thank you very much!

    Thank you very much for responding so quickly! When I do this all of the nested timelines play from the out label on their timeline. I want the one that is currently being viewed to be the only one that plays out, not all of the symbols within the symbol. Here is the code I'm using on the buttons on the main timeline:
    var current = sym.getVariable("current");
       if (current != "") {
          sym.getSymbol(current).play("out");
          sym.getSymbol("spec").play("in");
       else {
          sym.getSymbol("spec").play("shortIn");
       sym.setVariable("current", "spec");
       var techSym1 = sym.getSymbol("tech").getSymbol("techSym1")
             if (current = "techSym1") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym1").play("out");
       var techSym2 = sym.getSymbol("tech").getSymbol("techSym2")
             if (current = "techSym2") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym2").play("out");
       var techSym3 = sym.getSymbol("tech").getSymbol("techSym3")
             if (current = "techSym3") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym3").play("out");
       var techSym4 = sym.getSymbol("tech").getSymbol("techSym4")
             if (current = "techSym4") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym4").play("out");
       var techSym5 = sym.getSymbol("tech").getSymbol("techSym5")
             if (current = "techSym5") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym5").play("out");
       var techSym6 = sym.getSymbol("tech").getSymbol("techSym6")
             if (current = "techSym6") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym6").play("out");
    If just techSym1 is being shown on the screen I don't want techSym2 and all the others to be shown going out at all, just techSym1.
    Thank you,
    Kristin

  • Button from External SWF to Play Movie in Main SWF

    Hi Guys,
    Ok I'm working in Flash 8, Action Script 2;
    I'm building a website, in which the 'Gallery Page' has a link to an external swf file, which is a scrolling clip of thumbnails.
    What I want to do, is create each thumbnail into a button, which will then play a Movie Clip from a frame located in the Main swf file.
    (So basically, each thumbnail button is a small photo, will play that photo in a large scale as a movie)
    eg.
    thumbnail1_btn  needs to go to main swf and play movieclip1.mc, frame 1
    thumbnail2_btn nends to go to main swf and play movieclip1.mc, frame 2
    I'm unsure of the code for this? Or if I've built this up wrong?
    If someone could help me out, that would be great!

    If you haven't set _lockroot on the loaded SWF, than a simple _root call from the loaded SWF will talk to the main SWF.
    IE:
    on(release){
    _root.gotoAndPlay(1);
    If you did set the lockroot, then call the level directly, via:
    on(release){
    _level0.gotoAndPlay(1);
    Once on the root level, you can access a movie clip as normal.
    So:
    on(release){
    _level0.movieClip1.gotoAndPlay(1);
    will call the movie clip "movieClip1" which resides on the timeline of _level0 (which is main.swf in your instance), and tell it to jump to the first frame and start playing.

  • Attempt to move main timeline from inside a movie clip breaks menu buttons.

    I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.
    The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
    My code in the movie clip:
    stop()
    function replayMovie(event:MouseEvent):void
    MovieClip(parent).gotoAndStop(1);
    Menu.addEventListener(MouseEvent.CLICK, replayMovie);
    My code in frame 1 of the main timeline:
    stop();
    function bo(event:MouseEvent):void
    gotoAndPlay(21)
    SoundMixer.stopAll()
    espesp.addEventListener(MouseEvent.CLICK, bo);
    function ho(event:MouseEvent):void
    gotoAndPlay(31)
    SoundMixer.stopAll()
    espeng.addEventListener(MouseEvent.CLICK, ho);
    function yo(event:MouseEvent):void
    gotoAndPlay(41)
    SoundMixer.stopAll()
    engesp.addEventListener(MouseEvent.CLICK, yo);
    function go(event:MouseEvent):void
    gotoAndPlay(51)
    SoundMixer.stopAll()
    engeng.addEventListener(MouseEvent.CLICK, go);
    The error output when I use my Menu button at the end of the movie clip.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at SSubjunctiveProjNewgrounds_fla::MainTimeline/frame1()
    at flash.display::MovieClip/gotoAndStop()
    at SSubjunctiveProjNewgrounds_fla::Esp_5/replayMovie()
    Any help would be greatly appreciated.

    For the sake of space, I'll leave out all the package declarations and class declarations and just talk about the functions.
    First, the Game class, it has two functions.  The first one is the constructor function and it launches at the beginning of the game:  First the Game function:
    public function Game():void
    //Game code goes here
    }//Game
    We want to listen for someone to click the mouse on the MenuPage, so lets create a new MenuPage and add a listener to the button contiained within it.
    public function Game():void
    menuPage = new MenuPage;
    menuPage.startButton.addEventListener(MouseEvent.CLICK, startGame);
    addChild(menuPage);
    }//Game
    You will notice that before I declared a variable var menuPage:MenuPage, but that's all I did was declare it.  I didn't really make a new instance of it, I just set aside space for it.  In the first line within the Game function, I'm actually turning that variable into a new instance of a MenuPage.
    We don't have a picture of this imaginary menuPage instance, but lets' assume that in our MenuPage MovieClip in the library, we created a SimpleButton called startButton.  Here, I'm adding an EventListener that patiently waits for someone to click that button.  Once we receive that event, Flash is told to call the startGame function.
    As you get better at this, you'll get into custom events, and the eventListener for the button will exist in the MenuPage class file, or even in another class file that you create just for the button.  Something like StartButton.as  But for now, we can do it as above.
    Now the startGame function:
              public function startGame(evt:MouseEvent):void
    //Remove the start Page
    //Add the zombie
    //Add the gun
    }//startGame
    And we'll replace those comments with real code.  It follows along with what we just did above.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    And we also want to clean up some by removing the menuPage, and throwing out the eventListener.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    menuPage.startButton.removeEventListener(MouseEvent.Click,startGame);
    removeChild(menuPage);
    }//startGame
    Now our Game class is complete.
    The Zombie Class
    public function zombieWalk(evt:Event):void
    this.addEventListener(Event.ENTER_FRAME,zombieWalk);
    this.x = this.x + 10;
    }//zombieWalk
    Notice we've added a function to the Zombie Class.
    The first function adds an EventListener to the zombie.  We can use the word this and actionScript knows we're talking about the zombie that the class is written for.  This listener fires off every frame.  If our FLA file is set to 12fps, then 12 times every second it will call on the zombieWalk function.
    The zombie walk function moves the zombie 10 pixels to the right every time the function is called.
    On a more advanced level, you'll want to add animation in the MovieClip to move the zombie legs.  You'll also want to use Timer events to space out how often the funtion fires and not ENTER_FRAME events.  And you'll want to use a static constant to establish how far the zombie moves.  We have it now set to 10 pixels, but that can get irritating if we want to change that value later.  But again, baby steps.
    And finally, the Gun class
    public function Gun():void
    this.addEventListener(MouseEvent.CLICK, fireGun);
    }//function
    public function fireGun(evt:MouseEvent):void
    this.gotoAndPlay(2);
    }//fireGun
    First we add an EventListener for when someone clicks on the gun.  Once this happens, the listener calls on the fireGun function.
    The fireGun function takes advantage of the frames within the Gun MovieClip.  Say we have three frames in the Gun MovieClip.  The first is just a picture of the gun.  The second is the gun with a flash coming out of the nozzle.  And the third is the gun at rest again.  The line this.gotoAndPlay(2) sends the gun to the second frame with the flash graphic.
    For this to work, each frame in the Gun MovieClip has to have some stop and play commands.
    But.. you said no code on our timeline!! Liar!
    I know.  This is the exception.  You will need basic stop() commands and gotoAndPlay commands to loop animations.  Any MovieClip that has more than one frame will need something to control it.
    So our Gun MovieCLip has the following:
    Frame 1: stop();
    Frame 2: no actionScript... and I mean nothing, not even the words, "no actionScript"
    Frame 3: gotoAndStop(1);
    This will loop the gun to the beginning and wait for the next time the user clicks the gun.
    Advanced features of the Gun class might include a Bullet.as sub-class that creates a bullet MovieClip to fly across the screen.  Sound to play when the shooting takes place.  Object collision detection to see if the bullet hits the target.  And a means by which a custom event will tell the Game.as class that a zombie has been hit and it should be removed from the stage.
    As you go down the rabbit hole of ActionScript 3, you will find yourself at a point where it's just a matter of getting the syntax right for all the built in functions and classes.  Arrays, Loaders, casting variable types.. all that stuff will come.
    I hope this has been helfpul.  It's been on my to-do list for a long time.  When I first started out, no one could provide me with basic answers for how all these classes and whatnot worked.  After teaching myself AS3 for 2 years and reading a gabillion books, I think I've gotten to a point where I'm pretty comfortable with it all.

  • External swf button problem

    Hi,
    I have an external photo gallery with a previous and next
    buttons that loads into a main swf. When I test the external swf on
    its own the buttons work fine. But, when I load the external swf in
    the main swf the buttons work once and to make them work again you
    have to move your mouse a little to make it work again. You can not
    just leave your mouse over the button and just keep on clicking the
    way it works when I test the swf on its own.
    Is there away to make it work without moving the mouse after
    each click?
    Thanks in advance

    Hi I am using AS3
    button_3.addEventListner(MouseEvent.CLICK,fl_ClickToLoadUnloadSWF_3);
    var fl_Loader_3:loader;
    var fl_ToLoad_3:Boolean=true;
    function fl_ClickToLoadUnloadSWF_3(event:mouseEvent):void
    if(fl_ToLoad_3)
    fl_Loader_3 = new Loader();
    fl_loader_3.load(new URLRequest("new_products.swf"));
    addChild(fl_Loader_3);
    else
    fl_Loader_3.unload();
    removeChild(fl_Loader_3);
    fl_loader_3+null;
    fl_TOLoad_3 =!fl_ToLoad_3;
    This is the first half of the code for one button, the code for the second button is the same, just different variable names.
    thanks

  • Button Refer to Main Timeline

    Okay so I am unfortunatly new to AS3, so I apologize if there
    is a very obvious answer to this question.
    Okay Say I have a movie Clip on my main timeline and with in
    that movie clip is a button. That button has a CLICK event that I
    want o go back and refer to a "frame" on the main time line. How
    would I go about doing that?
    Here is what I thought I should do
    import flash.events.MouseEvent;
    WebSitesBtn.addEventListener(MouseEvent.CLICK,WebDesignBtnClick);
    function WebDesignBtnClick(event:MouseEvent):void{
    _parent:gotoAndStop("Web Design");
    "Web Design" is the Frame Label which I want to refer too
    Any ideas on what I am missing or how I can properly refer to
    the main time line?
    Thanks

    use parent, instead of _parent, if that code is in your
    movieclip.

  • Button not in main timeline

    Hello All,
    I am fairly new to flash and would greatly appreciate some
    help with this... I have many buttons that I need to attach event
    handlers to but they are embedded within layers of movie clips, and
    if I write the handler code in the main timeline's 1st frame they
    are nowhere to be found because they are no yet displayed. If I
    write the handler code in the movie clip that a button is contained
    in, and my action is to gotoAndPlay a frame of a different movie
    clip, that movie clip also not be found. My guess is that I need to
    write the code within the movie clip that the button is contained
    in and somehow call up the mainstage and then reference the movie
    clip that is to be played by the buttonClick event through its
    respective path... something like (in words):
    "look to stage" then...
    function buttonClick(speakevent:MouseEvent):void {
    portal_mc.logomov_mc.gotoAndPlay(63)
    speak_btn.addEventListener(MouseEvent.CLICK, buttonClick);
    can anybody tell me how to point back to the stage? or some
    other way of doing this? surely it is possible. any comments would
    be much appreciated.
    thanks, sander.

    kglad wrote:
    i'm assuming your buttons are movieclip buttons.  if "nextlevelbutton" is not the linkage id of a movieclip, your code makes no sense.  if it is a movieclip over and down states wouldn't work unless you had code elsewhere.
    scoresign.attachMovie("nextlevelbutton", "nextlevelbutton", scoresign.getNextHighestDepth(), {_x:126, _y:300});
    scoresign.attachMovie("mainmenubutton", "mainmenubutton", scoresign.getNextHighestDepth(), {_x:35, _y:300});
    scoresign.nextlevelbutton.onRelease=function(){gotoAndStop("first scene");
    scoresign.mainmenubutton.onRelease=function(){
    // do whatever

  • 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

  • Connecting external swf files to a main home page swf.

    Hi, sorry I realise theirs a few questions like this already out there, but I just cannot find the information I need with them. I have a home page in that their are 4 buttons which lead to 4 different pages, I essentially need mine to be able to click on a button and then have it go to that page,
    any help? thankyou!
    oh and Im working with Flash CS4 in AS3
    (try to use basic terms, im new to this)

    let me clarify im using this script
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    var url:URLRequest = new URLRequest("Games.swf");
    myLoader.load(url);
    i just need this to occur after I click a button?

  • Controlling multiple external swfs from main timeline

    Hi, I've been trying to combine the features of two tutorials I found, one that deals with controlling external swf's from the main timeline and the other that explains how to load and unload multiple external swf's.  I'd like to be able to load and unload multiple external swf's, and control these swf's buttons from the main timeline. 
    I asked this same question on the forum of the site where I found these tutorials, and receive only one reply saying that "it should'nt be hard to do." but they did not elaborate any further.  This left me think that I was missing something very obvious and I've spent too much time now trying to work what it is now.  I understand pretty much how both pieces of code work, but just can't work out how to combine them.
    If someone could explain it to me, I'd much appreciate it.
    Tutorial One code - controlling an external swf from the main timeline.
    var ldr:Loader = new Loader();
    var urlReq:URLRequest = new URLRequest("swfs/balls.swf");
    ldr.load(urlReq);
    function loadHandler (event:Event) {
    var myClip:MovieClip = event.target.content;
    addChild(myClip);
    function myClipOver(event:MouseEvent):void {
    myClip.myBlueBalls.stop();
    function myClipOut(event:MouseEvent):void {
    myClip.myBlueBalls.play();
    // set listeners
    myClip.addEventListener(MouseEvent.ROLL_OVER, myClipOver);
    myClip.addEventListener(MouseEvent.ROLL_OUT, myClipOut);
    // listener
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
    Tutorial Two code - loading and unloading multiple external swfs.
    var Xpos:Number = 110;
    var Ypos:Number = 180;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/eyesClosed.swf");
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    // Btns Universal function
    function btnClick(event:MouseEvent):void {
    removeChild(loader);
    var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
    loader.load(newSWFRequest);
    loader.x = Xpos;
        loader.y = Ypos;
    addChild(loader);
    // Btn listeners
    eyesClosed.addEventListener(MouseEvent.CLICK, btnClick);
    stingray.addEventListener(MouseEvent.CLICK, btnClick);
    demon.addEventListener(MouseEvent.CLICK, btnClick);
    strongman.addEventListener(MouseEvent.CLICK, btnClick);

    I will not be able to help you with whatever relaxatraja provided though it is purported by relaxatraja to be clearly explaining what I was explaining (???).
    Your loadHandler function appears a bit confused.  For the code you show I don't see you assigning any event listeners for the events that will be dispatched in the loaded file.  As I showed earlier, your loadHandler function should be assigning a listener for the event that will be dispatched (modified slightly below). and if you have three different events being dispatched in the loaded file, then you'll do better to have three different listeners.  I show only one below for one of the events you dispatch...
    function loadHandler (event:Event) {
      // assign a listener for the loaded file's goExit function's event
       MovieClip(event.currentTarget.content).addEventListener("close", event1Handler);
    // I can't make sense of what you have here
        removeChild(myClip); // why ?? - it hasn't been added yet as far as I can see - error 2007?
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf"); // the event.target is the Loader
        ldr.load(newSWFRequest); // this will load over the file you just finished loading??
        ldr.x = Xpos;
        ldr.y = Ypos;
        addChild(myClip);  // why?? it has nothing in it
    function event1Handler(e:Event):void {
        // do whatever is involved with what the "close" event is supposed to do
        trace("goExit function executed");
    As far as what you have in the loaded file, you appear to be trying to pass the files names as if they were parameters.  The file naming should be done at the receiving side for the event handler function for the event listener.  While you could create a custom event that include parameters that you can pass, that's another level of coding that is better left for a future experience.
    Study the following - understand it before you try to use it.
    Below is a link to some files I made for another posting that demonstrates what I have been explaining.  The neurope file is the main file.  Publish the netherlands file so that you have an swf to load for it, and then run the neurope file.  The file that gets loaded (netherlands) only has a button in it that when clicked dispatches an event for which the main file (neurope) has assigned a listener.  The main file displays a message when the button gets clicked in the loaded file.
    http://www.nedwebs.com/Flash/neurope.zip

  • Controlling loaded swf from main timeline

    Hello,
    I'm working on loading external swf files for ios. I am able to load the swf files and set them to visible or invisible in different frames. I am having trouble controlling the loaded swf files from the main timeline. Specifically, I would like to have a button on the main timeline, that when clicked will move a loaded swf to frame 1.
    Here is a code that loads one swf file:
    var myLoader1:Loader;
    var loaderContext1:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
    if(myLoader1 == null)
              myLoader1 = new Loader();
              addChild(myLoader1);
    myLoader1.load(new URLRequest("folder/file1.swf"),loaderContext1);
    myLoader1.visible = true;
    backbutton.addEventListener(MouseEvent.MOUSE_DOWN, backbutton1);
    function backbutton1(myEvent:MouseEvent):void {???????????? myLoader1.gotoAndStop(1);}  (this line does not work)
    (Once I load file1.swf, within the file1.swf I click a forward button to move to different frames. My question is: how do I code the 'backbutton' on the main timeline so that it causes the loaded file1.swf to go to frame 1?)
    Thank you for your help.

    sure.
    if the movieclip on the loaded swf's main timeline has reference mc, you would use:
    MovieClip(myLoader.content).mc.gotoAndStop(1);
    p.s.  you might find the following helpful,  http://kb2.adobe.com/community/publishing/918/cpsid_91887.html

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    /*loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;*/
    addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
    function onEnterFrame(ev:Event):void {
    var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent):void {
    // re adds listener for contact.swf and about.swf
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = null;
    loader = new Loader();
    loader.name ="carousel"
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    function Down1(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    var requester:URLRequest=new URLRequest("contactLoader.swf");
    loader2 = null;
    loader2 = new Loader();
    loader2.name ="contact"
    loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader2.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    function Down3(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    var requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds listener for contact.swf and about.swf
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         var requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         var requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • GotoAndPlay specific frame in external swf from main swf

    I have a main swf that loads 2 external swfs.
    I click on button to see content of external swf #1 and see stuff. I do something that causes external swf to show other stuff (i.e. not at beginning state)
    In the main swf I click on button to see content of external swf #2. External swf #1 content is made invisible and I see content of external swf stuff.
    NOW, if I click on button to take me back to see external swf #1, I see it's content in current state. I want to force it to start over again at frame #1 which will reset content.
    However, no matter what I try, I can't seem to control which frame to go to in external swf using gotoAndplay.
    Here is code in frame #1 of main swf to load external swfs:
    //load academic movie
    var swfLoader1:Loader = new Loader();
    container1.addChild(swfLoader1);
    var url1:URLRequest = new URLRequest("academic.swf");
    swfLoader1.load(url1);
    //load wisdom movie
    var swfLoader3:Loader = new Loader();
    container3.addChild(swfLoader3);
    var url3:URLRequest = new URLRequest("wisdom.swf");
    swfLoader3.load(url3);
    Here is code in frame 2 of main swf that checks button to see where to go in external swf:
    //academic button clicked
    function academicClick(event:MouseEvent){
       container3.alpha = 0;
       container3.visible = false;
       container1.visible = true;
       container1.gotoAndPlay(1); //this is where I am trying to force it to start at frame 1
       container1.alpha = 1;
    I don't want to reload the external movie to force it to start over.
    Any help would be much appreciated.

    You can easily control this by making the external swf to load with your movieclip, The below is the code snippet that clear on accessing the specific frame on external swf.
    //Loading clips content
    var ldr:Loader;
    var mcExt:MovieClip;
    //Loading
    loadswf("external.swf");
    function loadswf(tmp:String):void{
        unloadSwf();
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    //UnLoading
    function unloadSwf():void{
        if (ldr!=null){
            ldr.unloadAndStop();
            removeChild(mcExt);
            mcExt=null;
    //Intervals (The part you work on the specific frame within the external swf
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        if (num==1) mcExt.play();
        if (num==9) {
                mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                function skipfn(e:MouseEvent):void{
                    mcExt.stop();
                    mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
        if (num==mcExt.totalFrames){
            mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
            gotoAndStop("help");
    hope it solve

  • Adding a Glossary button which doesnt move the timeline on !

    I'm using Captivate 3. On each page there is a
    backwards/forwards button. On this one module we've now added a
    'Glossary button'. If the user clicks this it opens up a external
    PDF file in a seperate window. That works fine.
    Say they are at the end of a page , the page is paused as its
    waiting for them to click Back/Forward or Menu.
    However if they click the Glossary button this moves the
    timeline forward as its a kind of 'continue' which is frustrating
    as it then moves to the next page. I just want them to be able to
    click Glossary as many times as they want and the program doesnt
    move on a page.
    Has anyone come across this before ? Just want a button which
    doesnt seem to move on ! Its not set to continue at all. Just set
    to open an external file
    Regards

    Hello P_SJ,
    The way I would tackle this would be to create the button in
    Adobe Flash (including the link to the PDF document) and then
    import this into Captivate as an animation. The reason for me
    suggesting this is because with Images and Animations you can make
    the object persist for the entire project (Options tab > Display
    for > rest of project).
    If you don't need the button to persist then you could just
    disable the Pause after option (Options tab) in the Button dialog
    and set the On success menu option to Open URL or file.
    I guess that even if you did need the button to persist you
    could just copy the button and paste this onto all the relevant
    slides. That might work as well.
    HTH
    Regards - Mark

Maybe you are looking for

  • "Role not defined for individual users" on user import

    Hello, I am trying to import a certain user from one portal to another and I get this warning message: "Role <pcd_role_path> not defined for individual users." This role is assigned to this user at the 1st portal and exists at the 2nd portal at the s

  • Shipping Tab in STO PO

    Hi Experts While we are creating an STO with the same supplying plant and receiving plant, the Shipping tab in the item details is getting vanished. The shipping tab is appearing when we are entering the details, its getting vanished the moment we Sa

  • Disc burner or software not found...how do I fix this?

    Trying to burn a cd from itunes, never had a problem before and i get the message "disc burner or software not found' How do I rectify this? I have a Mac version 10.6 software and itunes is up to date.

  • Exercise 9 Creating New Flex Project

    Thanks to Ryan aka rsadwick, I was able to get LiveCycle and the ODT zip file working properly (see his reply to "Problem with one of the lessons"). Unfortunately when I try and create a new Flex Project using LCDS I am unable to get past the second

  • Large pool size

    Hi, how to resolve the problem ORA-04031 my SGA is 504439252 455124 478150656 25165824 667648 java_pool_size 159383552 large_pool_size 16777216 shared_pool_reserved_size 10485760 shared_pool_size 209715200 This problem occurred when export full the D