Looping a movieclip

Hi
I have a movieclip which im scrolling using the following
script:
down_btn.addEventListener(MouseEvent.MOUSE_DOWN,buttonPressed2);
up_btn.addEventListener(MouseEvent.MOUSE_UP,buttonPressedprev2);
function buttonPressed2(event:MouseEvent){
landscape_mc.nextFrame()
function buttonPressedprev2(event:MouseEvent){
landscape_mc.prevFrame()
function buttonPressed(evt:MouseEvent){
stage.addEventListener(Event.ENTER_FRAME, goNext)
function buttonReleased(evt:MouseEvent){
stage.removeEventListener(Event.ENTER_FRAME, goNext)
function goNext(evt:Event):void {
landscape_mc.nextFrame();
down_btn.addEventListener(MouseEvent.MOUSE_DOWN,buttonPressed);
down_btn.addEventListener(MouseEvent.MOUSE_UP,buttonReleased);
function buttonPressed3(evt:MouseEvent){
stage.addEventListener(Event.ENTER_FRAME, goNext3)
function buttonReleased3(evt:MouseEvent){
stage.removeEventListener(Event.ENTER_FRAME, goNext3)
function goNext3(evt:Event):void {
landscape_mc.prevFrame();
up_btn.addEventListener(MouseEvent.MOUSE_DOWN,buttonPressed3);
up_btn.addEventListener(MouseEvent.MOUSE_UP,buttonReleased3);
all works fine, but what id like to do is to have the
movieclip loop so that when "landscape_mc" gets to the last frame
it will go back to frame 1. ive added the gotoAndPlay ("1") to the
last frame and this works fine whilst utilising the "nextFrame"
command but not when using the "prevFrame"
is there a way round this?
Many thanks in advance

Hi there,
You can add an if function to the "landscape_mc.prevFrame();"
part. For example:
if(landscape_mc._currentframe == 1){
landscape_mc.gotoAndStop("put here the last frame of the
landscape_mc");
} else {
landscape_mc.prevFrame();
You can do the same with the "landscape_mc.nextFrame();"
part. So that the movie returns to frame 1.
Greetings,
Guido
Creation site internet Bordeaux |
Echantillons Gratuits |
Jeux Flash |
Programme TV

Similar Messages

  • How can I loop a movieclip in Flex?

    Hi all,
    I load a swf movieclip with SWFLoader, but I don't know how
    to loop it. That is, I want it play like a rotating circle. Is this
    possible?
    Thanks for the help.

    I'm trying to create a flash which is able to load other swf
    movieclips created by other persons. Some of these swfs I need to
    load have a loop script, and some don't have. I have to loop these
    swfs in my own flash without changing them.
    Do u think I can do that with image? thanks.
    quote:
    Originally posted by:
    upshotvideo
    Have you tried using image instead of swfLoader, and does
    your flash timeline have a script at the end of the timeline to go
    back to frame 1?

  • Remove duplicate movieclips problem

    I have a shooter game where i duplicate bullet holes in the wall.  Works nicely though i have to use Version: Flash Player 6 for the code to work.  Here is the simple code:
    hit1.onPress=function(){
         i++;
         _root.bullet.duplicateMovieClip("bulletNew", i);
    I have a Reset Button that i would like to use to remove all the duplicate "bulletNew" movieclips at once.  This is what i have so far but it only removes one duplicate at a time:
    reset_mc.onRelease=function(){
         removeMovieClip("bulletNew");
    Please be clear with instructions because I have never grasped AS too well.
    Thanks.

    to publish for later fp versions, initialize your variables (like i) and check upper/lower case of all code.
    var i:Number=0;
    var tl:MovieClip=this;
    hit1.onPress=function(){
         i++;
         _root.bullet.duplicateMovieClip("bulletNew"+i, i);
    reset_mc.onRelease=function(){
       for(var j:Number=0;j<i;j++){
    if(tl["bulletNew"+i]){
    tl["bulletNew"+i].removeMovieClip();
    p.s.  if that's the only place you create bullet holes, you can make that code more efficient by only looping through movieclips that exist.  for example:
    var i:Number=0;
    var bulletNewA:Array=[];
    hit1.onPress=function(){
    bulletNewA.push(_root.bullet.duplicateMovieClip("whatever",i));
    reset_mc.onRelease=function(){
    for(var j:Number=bulletNewA.length-1;j>=0;j--){
    var mc:MovieClip=bulletNewA.splice(j,1)[0];
    mc.removeMovieClip();

  • Looping a swf movie

    ive been looking the other posts involving this and they just
    wont work for me,
    all i want to do is loop my little movie for my website but
    it just wont loop ive clicked the loop button and all that but it
    just wont loop, can anyone please help , ive imported my movie to
    the stage and selected progressive download etc and the movie is
    there its just what to do next

    You mean you want to loop an FLV, correct? That is more
    involved then just looping a movieclip. Make sure you put a stop
    action on the frame and follow my directions from the other threads
    about giving the component an instance name of vid and using the
    actionscript...
    var vidList : Object = new Object();
    vidList.complete = function() {
    vid.play();
    vid.addEventListener ("complete",vidList);
    stop();

  • Multiple Line Graph

    First off, thanks to kglad for the line graph function I
    started with, it has been a huge help. Now the step I'm trying to
    take is 2 fold.
    First, I'd like to graph more than one line segment on the
    graph. Right now I am graphing functions f1 and f2, but f2
    currently overwrites f1. I want them to coincide so f1 goes from
    x=1 to x=15, f2 goes from x=15 to x=25, f3 goes from x=25 to x=10
    at a different y (these are all curves), and finally f4 goes from
    x=10 to x=1 creating a closed shape. Also, I want the x values and
    the y values to be variable based on the temperature. I'm using
    PV=nRT and n, R, and T are all known. so I have something like
    P=nRT/V where P is y, V is X and the nRT can be calculated for two
    steps of the 4. The other two steps are adiabatic, so Q=0, I don't
    know yet how to fit the lines but i do know that y = a / (x^(5/3))
    is a formula that works, I just need to find the proper a values
    for steps 2 and 4.
    Part two of this issue is that currently the graph is drawing
    as the whole canvas, which is fine for testing until i get the
    multiple line part worked out; however I only want this to be 1/4
    of the viewing area as I have other movie clips and such to put on
    this. A conceptual drawing of what I plan on making can be found
    at:
    http://www.students.bucknell.edu/gbement/Steps.html
    I'm a novice to Actionscript and movie clips, I previously
    did everything with motion tweens and nothing was dynamic. I plan
    on creating the piston and molecule simulation in another movie
    clip, then I can vary the play speed relative to the hot and cold
    temperatures by looping the movieclip and having it play faster for
    a high T and slower for a low T.
    Any help on any of my many issues would be greatly
    appreciated and the user will be recognized for their assistance in
    my research presentation :)

    Hi Arun, thanks again for the help but upon closer inspection
    (along with only a basic knowledge of java and actionscript), I
    think your script would need editing to work for me (editing i'm
    unsure of how to do). What I'm looking for is a graph that will
    create a line based on a function. Much like y=(a*b*c)/x or
    y=(a*b*c)/(x^1.66) The a*b*c would be complicated also, but here's
    what i've thought up on paper that I have to move to script, I hope
    this is useful:
    Step 1: Calculate the a*b*c
    The original function is PV=nRT , nRT being the a*b*c ,
    however the Thot and Tcold terms are input boxes that the user
    types in before hitting the "go" button.
    So I have to do this much:
    tcold = Number(tcold_num.text);
    thot = Number(thot_num.text);
    var n:Number = 1;
    var R:Number = 0.0825;
    var a:Number;
    var b:Number;
    var c:Number;
    var d:Number;
    a = n*R*thot // Step 1 constant
    b = // Step 2 constant (formula to be finished :-/) Looks to
    be a formula using ((b) / (Math.pow(x, 1.666)))
    c = n*R*tcold // Step 3 constant
    d = // Step 4 constant (formula to be finished :-/)
    Then I need to find a way to initialize axis to line the
    graph, I can label the P and V axis using static text boxes later I
    suppose.
    The problem I have with yours that I don't understand is that
    I could add the function into the y part of the addLine() function,
    however it's noted as inity= y1 (requires a number), and the
    function definition has y1:Number.
    Now the issue i'm tackling below is just a newbie's lack of
    understanding (i hope), but the script kglad wrote (snipped below)
    will graph one line, and i can't figure out for the life of me how
    to write this up to graph more than one instance without
    overwritting the previous line. Again, Thanks for the help so far,
    it has helped me find the points where I lacked direction and solid
    ideas before.

  • Preview is different than final compile? HELP PLEASE

    This is a simple test animation, but 2 things go wrong when I compile it
    1: the clouds in the compiled version move at different speeds than when I hit "play" in the workstation
    2: one of the clouds dissapears (the bottom one), and then reappears randomly, something that it doesn't do in the workstation
    Ive tried it in different layers, with different types of objects, and even capturing it frame-by-frame, but it always messes up when i export it!
    Heres the .fla and the .swf files, if someone could look and see if i'm overlooking something and give me feedbac
    http://speedy.sh/fxWTk/RECOVER-RECOVER-1.fla

    Hi,
    It looks like you have accidently added the same motion tween twice at different levels of nesting within the same symbol. Also within nesting, you're using Movieclip instance somewhere and Graphic instance at other places.
    This answers both of your queries:
    1. Speed is different because the resultant speed is the addition of two motions along the same path. (When previewing within application, animations within a movieclip are not shown but within Graphics are shown.)
    2. The disappearance happens due to the same eason. The start and end point of a grapic animation is dependent on the parent timeline and remains the same during looping. Movieclip animations on the other hand, always play completely and may spill over multiple loops. So basically the start point of the animation is getting shifted with every loop.
    You can remove one of the tweens from the nested symbol to fix this.
    -Nipun

  • How to make a loop that changes two different movieclips from visible to invisible every second

    I am writing some code that puzzles me. It may be, because I have a cold or because I've never needed to do anything like this. I want to have two movieclips one is visible and one is not. then one second passes the one that was visible is invisible and the invisible one is visible. What would be the best approach to this, besides handcoding if statements. I know there has to be a faster way and less expensive way than handcoding if statements.
    I'd like to thank anyone who replies in advance .

    this is how i would do it
    package
              import flash.display.MovieClip;
              import flash.display.Sprite;
              import flash.events.TimerEvent;
              import flash.utils.Timer;
              public class Main extends Sprite
                        private var mc1:MovieClip;
                        private var mc2:MovieClip;
                        public function Main()
                                  // create your mc's here
                                  mc1 = new MovieClip();
                                  mc2 = new MovieClip();
                                  mc2.visible = false;
                                  var timer:Timer = new Timer(1000);
                                  timer.addEventListener(TimerEvent.TIMER, loop);
                                  timer.start();
                        private function loop(e:TimerEvent):void
                                  mc1.visible = !mc1.visible;
                                  mc2.visible = !mc2.visible;

  • Flash Slide  presentation and movieclip looping

    Hi,
    Im having a problem with the flash slide presentation. I have
    on the main timeline of one of my slides a movieclip. When i play
    the movie, the clip will loop endlessley. I would like the movie
    clip to play just once. In a regular flash movie this would not be
    a problem - i could put a stop action on the last frame of the
    movieclip. but, doing that in the context of a flash slide freezes
    the movieclip at the begining so it does not play at all..
    help!

    Ok, Ive managed to solve item 2. - if you set in the slide
    component inspector - "playHidden=false" then the slide animation
    will restart any time you reenter the slide. Im still lacking an
    understanding of how to stop a motion tween from repeating itself
    when it's contained within a movie clip as a motion tween timeline
    cannot recieve fram actions apparently...

  • Loop timeline in movieclip then gotandplay frame

    Hi all,
    I have an animation of a dog running across the stage and a movieclip called "legs" which is the legs moving. I want to loop the dogs legs for a certain amount of frames and then make it stop on a certain frame within that same nested "legs" movie clip.
    Can anyone tell me how to do this and where the actionscript should go??
    Many thanks!
    Zoe

    In that frame you can place a conditional that tests how many times the animation has gone thru it and then have it stop at a particular number of times.  In the example code below, it stops on the 5th time thru.
    var counter;
    if(counter == null){
        counter = 1;
    } else {
        counter += 1;
        if(counter == 5){
            stop();

  • AS3 Newbie: Looping movieclips & overlapping movies.

    Hello all this is my first time posting in the forum and your help would be greatly appreciated!
    The issue I am having is that the animation will play fine on my mac but when opened on a Windows OS it just loops and all the movieclips overlapp.
    I am looking for a quick clean code solutiion I used code snippets to control the movie and do not have a knowledge of hand-coding AS.
    Download animation here: http://dl.dropbox.com/u/1491983/frac_animation.swf
    Note:
    It is all set in one scene and one frame all of the movies are nested.
    What I want the animation to do:
    Button 1 activates a series of movieclips, stops when another button is selected and resumes at the begining again when clicked.
    Button 2 Same action ability as button 1
    Button 3 Same action ability as button 1
    This is the snippet based code I am using now:
    step1.arrows1b.stop();
    step1.arrows1a.stop();
    step1.arrows1c.stop();
    step2.arrows1a2.stop();
    step2.arrows1d.stop();
    step2.focusWin.stop();
    step2.waterjets.stop();
    step3.focusWin2.stop();
    step3.gasDot.stop();
    step3.arrowsOut.stop();
    step3.fractures.visible=false
    button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_11);
    function fl_ClickToGoToAndPlayFromFrame_11(event:MouseEvent):void
        gotoAndPlay(1);
        step1.arrows1b.play();
        step1.arrows1a.play();
        step1.arrows1c.play();
        step1.arrows1b.visible=true
        step1.arrows1a.visible=true
        step1.arrows1c.visible=true
        step2.arrows1a2.visible=false
        step2.arrows1d.visible=false
        step2.focusWin.visible=false
        step2.waterjets.visible=false
        step3.focusWin2.visible=false
        step3.gasDot.visible=false
        step3.arrowsOut.visible=false
        step3.fractures.visible=false
    button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_12);
    function fl_ClickToGoToAndPlayFromFrame_12(event:MouseEvent):void
        gotoAndPlay(1);
        step2.arrows1a2.play();
        step2.arrows1d.play();
        step2.focusWin.play();
        step2.waterjets.play();
        step2.arrows1a2.visible=true
        step2.arrows1d.visible=true
        step2.focusWin.visible=true
        step2.waterjets.visible=true
        step1.arrows1b.visible=false
        step1.arrows1a.visible=false
        step1.arrows1c.visible=false
        step3.focusWin2.visible=false
        step3.gasDot.visible=false
        step3.arrowsOut.visible=false
        step3.fractures.visible=false
    /* Click to Go to Frame and Play
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
    Can be used on the main timeline or on movie clip timelines.
    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    button_3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_13);
    function fl_ClickToGoToAndPlayFromFrame_13(event:MouseEvent):void
        gotoAndPlay(1);
        step3.focusWin2.play();
        step3.gasDot.play();
        step3.arrowsOut.play();
        step2.arrows1a2.stop();
        step2.arrows1d.stop();
        step2.focusWin.stop();
        step2.waterjets.stop();
        step2.arrows1a2.visible=false
        step2.arrows1d.visible=false
        step2.focusWin.visible=false
        step2.waterjets.visible=false
        step1.arrows1b.visible=false
        step1.arrows1a.visible=false
        step1.arrows1c.visible=false
        step3.focusWin2.visible=true
        step3.gasDot.visible=true
        step3.arrowsOut.visible=true
        step3.fractures.visible=true

    in your situation, you are going about it the correct way.
    There is really nothing you can do, and you won't even see a
    performance drop, so keep it up.
    "I'm sorry but I'm not very good in speaking and writing
    english."
    I thought you did very well.

  • How to load one movieclip after the other, without looping?

    Hi,
    I am new to Flash, and am trying to make this file work, in Flash CS4, using AS2. First some info on my file. I have 2 movieclips, mc1 and mc2. mc1 is in the first frame in scene1, it plays out for 138 frames, after which the scene darkens for 15 frames and then mc2 starts playing.
    The problem is that I cannot get the timeline to stop looping after it moves onto to mc2. I have tried everything, I have a stop function in the last frame, stop functions within mc2. I even tried a gotoandStop(mc2_Frameno). Nothing works. It still keeps looping. When I extended the mc1 layer to the complete extent of mc2 layer, then it did not loop. But I don't want that as it is causing undesirable effects on the screen.
    All I want is to play mc1 and mc2 one after the other, with no breaks. After entering mc2, the timeline needs to stop once buttons are loaded in mc2. But after loading the buttons, it moves out of mc2 and starts playing the timeline again.
    I am extremely frustrated as I cannot understand why this is happening. I am new and am clearly unaware of the mistake I am making, and would really really appreciate it if someone could tell me how to do this. mc1 and mc2 are not loaded with AS2, just put on the stage at the right frames. I tried to unload mc1 with unloadMovie, but it still won't work. Please Help Me.

    If you can make your fla file available for download as a CS3 or earlier file version (I don't have CS4), I can take a look at it.

  • Looping video in a MovieClip

    I have a imported video converted to MovieClip, so that I am able to make mouse events, dragging etc to it.
    The problem is that i want it to loop forever. Regular FLVplayback codes doesn't anymore work after converting to MovieClip.
    I also tried to make the video as a embedded timeline video, but the video duplicates or the actions freezes after a moment.
    Anyone know how to make MovieClip video to loop or solve the embedded video duplicating problem? Or is it possible to make the source video loop externally.

    If that's the option you selected when you imported it, then you need to assign an instance name to the FLVPlayback component inside the MovieClip and to the MovieClip as well.  Use  them to assign an event listener for the flv player to detect when it is done playing so you can start it playing again. 
    For the example shown below I have named them flvplayer and flvmc, respectively...
        // in the timeline containing the MovieClip...
        flvmc.flvplayer.addEventListener(Event.COMPLETE, playAgain);
        function playAgain(evt:Event):void {
            flvmc.flvplayer.play();

  • MovieClip Preloader keeps looping movie

    MovieClip Preloader keeps looping movie
    I made a MovieClip preloader and everything workes fine.  The problem is the movie that I am loading  keeps looping.  Is there any way to stop this from looping?  I used  Flash CS5, AS2.
    Here is the code that I am using:
    bar._visible = false;
    border._visible = false;
    this.createEmptyMovieClip("container", "100");
    my_mc = new MovieClipLoader();
    preload = new Object();
    my_mc.addListener(preload);
    preload.onLoadStart = function(targetMC) {
    trace("started loading "+targetMC);
    container._visible = false;
    bar._visible = true;
    border._visible = true;
    pText._visible = true;
    preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
    bar._width = (lBytes/tBytes)*100;
    pText.text = "% "+Math.round((lBytes/tBytes)*100);
    preload.onLoadComplete = function(targetMC) {
    container._visible = true;
    border._visible = false;
    bar._visible = false;
    pText._visible = false;
    trace(targetMC+" finished");
    //default image
    my_mc.loadClip("main.swf", "container");

    Thank you for responding
    The stop action stopped the movieclip preloader from looping the movie, but now it shows a black screen at the end instead of the last frame of the movie. 

  • Unexpected jump of MovieClip when looping

    I am using a dragable MovieClip. When dragging it around in
    the movie it remains where I put it when the movie comes to the end
    and loops.
    BUT, when the same movieclip is assigned new x and y
    coordinates (by a button), and then dragged around, the movieclip
    jumps back to the starting position when the movie loops.
    Why is it like this?
    What can I do to avoid this "jump" ?
    tm

    Yes, it is just a part of the code (that I believed to be
    essential for this problem.
    Here is some more:
    shadow_mc._alpha = 65;
    small_legend_circle_mc.onRollOver= function() {
    shadow_mc._x = small_legend_circle_mc._x;
    shadow_mc._y = small_legend_circle_mc._y;
    shadow_mc._height =small_legend_circle_mc._height+1;
    shadow_mc._width =small_legend_circle_mc._width+1;
    shadow_mc.swapDepths(this.getDepth() +1);
    medium_legend_circle_mc.onRollOver= function() {
    shadow_mc._x = medium_legend_circle_mc._x;
    shadow_mc._y = medium_legend_circle_mc._y;
    shadow_mc._height =medium_legend_circle_mc._height+1;
    shadow_mc._width =medium_legend_circle_mc._width+1;
    shadow_mc.swapDepths(this.getDepth() +1);
    large_legend_circle_mc.onRollOver= function() {
    shadow_mc._x = large_legend_circle_mc._x;
    shadow_mc._y = large_legend_circle_mc._y;
    shadow_mc._height =large_legend_circle_mc._height+1;
    shadow_mc._width =large_legend_circle_mc._width+1;
    shadow_mc.swapDepths(this.getDepth() +1);
    shadow_mc.onPress = function() {
    this.startDrag();
    shadow_mc.onRelease = function() {
    stopDrag();
    if ((shadow_mc._x > 300) && (shadow_mc._y >
    300)) {
    shadow_mc._x = 460;
    shadow_mc._y = 478;
    shadow_mc.swapDepths(medium_legend_circle_mc.getDepth() -1);
    if (shadow_mc.hitTest(circle_map_mc)) {
    hit = true;
    else {
    hit = false;
    Tidsstolpe_mc.onEnterFrame = function() {
    if ((shadow_mc._height < circle_map_mc._height)/*
    && (hit)*/) {
    etc. etc.

  • How do you run loop functions on specific frames of nested Movieclips?

    I'm still pretty new to AS3 and I've run into a problem that I never had with AS2.  I have a project where the 1st frame of the main timeline is the loading screen and the second frame has buttons and a title bar that I want to be on every "page" of my project.  There are 7 buttons that take the user between 7 different "pages", which consist of 7 frames of a movieclip I have filling the content area on frame 2 of my main timeline.  I'll call this movieclip "pages_mc".
    The problem is that frame 6 of the pages_mc movieclip has the following code:
    var moving = 0;
    var xmoved;
    var xbegin = pano_cont.pano_image.x;
    parts_mc.addEventListener(Event.ENTER_FRAME, moveImage); // constantly moves the image 1 pixel left or right depending on the button pressed
    btn_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft); //changes the variable "moving" to 2 on mouse down
    btn_right.addEventListener(MouseEvent.MOUSE_DOWN, moveRight); //changes the variable "moving" to 1 on mouse down
    btn_left.addEventListener(MouseEvent.MOUSE_UP, stopMoveLeft); //changes the variable "moving" to 0 on mouse up
    btn_right.addEventListener(MouseEvent.MOUSE_UP, stopMoveRight); //changes the variable "moving" to 0 on mouse up
    function moveImage(e.Event):void{
    xmoved = xbegin - pano_cont.pano_image.x;
        if(moving == 1)
            pano_cont.pano_image.x -= 1;
        if(moving == 2)
            pano_cont.pano_image.x += 1;
        if(xmoved < -(pano_cont.pano_image.width/2)+180)
            pano_cont.pano_image.x = -2538;
        if(xmoved > (pano_cont.pano_image.width/2)- 180)
            pano_cont.pano_image.x = -2178;
    function moveRight (e:MouseEvent):void
        btn_right.gotoAndStop("down");
        moving = 1;
    function moveLeft (e:MouseEvent):void
        btn_left.gotoAndStop("down");
        moving = 2;
    function stopMoveLeft (e:MouseEvent):void
        moving = 0;
        btn_left.gotoAndStop("active");
    function stopMoveRight (e:MouseEvent):void
        moving = 0;
        btn_right.gotoAndStop("active");
    This is all just some code to allow users to move a panaromic image around on the screen.  But when I navigate to a different page from of my pages_mc movieclip I get the following output message:
    TypeError: Error #1099: Cannot access a property or method of a null object reference.
         at SampleProject_fla::Content_MC_1/moveImage()
    I'm thinking this is happening because the "parts_mc" movieclip I referenced for the ENTER_FRAME event listener no longer exists (unless you go back to frame 6 of pages_mc).  I'm not sure how to remove this event listener when the user moves to another frame of pages_mc.
    Any help would be greatly appreciated.

    kglad wrote:
    what's parts_mc.parts_mc???
    Not sure where you see that.  I see pages_mc.parts_mc which is just because the parts_mc movieclip is nested on the 6th frame of the pages_mc movieclip.
    At any rate, I was able to get it working by moving all the code onto frame 2 of the main timline and declaring all of my vairables on frame 1 of the main timeline.  I then added an ENTER_FRAME event listener onto one of my movieclip buttons (main_btn) on the main timeline and had it check what frame the pages_mc movieclip was on.  If it was frame 6, I then executed the moveImage function and had it remove the event listener from the main_btn movieclip if the frame changed away from frame 6.
    Seems to be working so far.
    Here's the code:
    Frame 1
    /* Declaring variables. */
    var pagenumber:Number;
    var moving:Number = 0;
    var firstTime:Number = 0;
    var xmoved:Number;
    var xbegin:Number;
    Frame 2
    pages_mc.addEventListener(Event.ENTER_FRAME, pageNum);
    pages_mc.addEventListener(Event.ENTER_FRAME, BtnSelParts);
    /* Keeps track of current page. */
    function pageNum(e:Event):void
        pagenumber = pages_mc.currentFrame;
        title_bar.gotoAndStop(pages_mc.currentFrame);
    function BtnSelParts(e:Event):void
        if(pagenumber == 6)
            btn_parts.gotoAndStop("current");
            if(firstTime == 0)
                btn_main.addEventListener(Event.ENTER_FRAME, moveImage); //moves the panorama image left or right
        else
            if(btn_parts.currentFrame == 32)
                btn_parts.gotoAndStop(1);
    function moveImage(e:Event):void
        if(pagenumber==6)
            if(firstTime == 0)
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_OVER, overLeft); //animates left arrow button on rollover
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_OVER, overRight); //animates right arrow button on rollover
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft); //changes the variable "moving" to 2 on mouse down
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_DOWN, moveRight); //changes the variable "moving" to 1 on mouse down
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_UP, stopMoveLeft); //changes the variable "moving" to 0 on mouse up
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_UP, stopMoveRight); //changes the variable "moving" to 0 on mouse up
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_OUT, rollOutLeft); //animates left arrow button on rollout
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_OUT, rollOutRight); //animates right arrow button on rollout
                xbegin = pages_mc.parts_mc.pano_image.x;
                firstTime = 1;
            xmoved = xbegin - pages_mc.parts_mc.pano_image.x;
            if(moving == 1)
                pages_mc.parts_mc.pano_image.x -= 1;
            if(moving == 2)
                pages_mc.parts_mc.pano_image.x += 1;
            if(xmoved < -(pages_mc.parts_mc.pano_image.width/2)+180)
                pages_mc.parts_mc.pano_image.x = -2538;
            if(xmoved > (pages_mc.parts_mc.pano_image.width/2)- 180)
                pages_mc.parts_mc.pano_image.x = -2178;
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 1)
                pages_mc.btn_sel.gotoAndStop(1);
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 2)
                pages_mc.btn_sel.gotoAndStop(2);
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 3)
                pages_mc.btn_sel.gotoAndStop(3);
        else
            btn_main.removeEventListener(Event.ENTER_FRAME, moveImage);
            firstTime = 0;
    } // controlls the panaromas
    Let me know if you see any problems with this.
    Thanks again.

Maybe you are looking for

  • Help: use command "run" and "exec", no output

    I create a script file Test.sql, and type "run d:\test.sql" in ttisql's command prompt, but there is no output, not even any error messages. Command> run d:\test.sql; Command> I try to use "Prepare" and "Exec", still no output Command> prepare 1 sele

  • User of Final Cut Pro X wants sound editing

    Hello Logic Pro looks good. Does it integrate well with FCPX for editing sound on timelines? Thanks

  • Best way to move LOB between database

    I am using Oracle 10.2.0.4. Please share your experience what is the best to move LOBs between databases. Lob size is 40 gb. I have tried using data pump, and parallel insert with nologging but it is taking almost 1 hour to transfer 1 gb. Thanks for

  • How do I change the color of a subscribed calendar?

    How do I change the color or a subscribed calendar? I can right-click the calendar in the sidebar in iCal, choose Get Info and change the color patch, but iCal returns an error and will not change the color. The error states that "Access to account "

  • Could not send mail through smtp

    try props.put("mail.smtp.host", this.getSmtpHost()); props.put("mail.transport.protocol", "smtp"); props.put("mail.server", this.getSmtpHost()); mailConnection = Session.getInstance(props, null); mailConnection.setDebug(true); trans = mailConnection.