2 Replies Latest reply on Feb 16, 2010 12:30 AM by nunozz

    Making steps in Actionscript

    nunozz

      hi everyone, was wondering if I could get alil help on this one..

      Basically I have a movie clip and 4 buttons.. When one of the buttons is clicked the movie clip (initially outside the stage) plays and comes to the middle of the stage next to the buttons and stops, and using .attachMovie I am attaching bitmap pictures into the movie clip.

      Each button displays a different bitmap.

      I also used an if condition with _currentframe == x to see if the movie clip is on stage or not when a button is clicked.

      If the movie clip is not on stage it plays the tween where it comes in, while if the movie clip is already on stage when a button is clicked, the movie clip leaves the stage first and comes in with a different bitmap (depending on which button is clicked, say button1=picture1, button2=picture2, etc.)

      Code:
      on (release) {
      if (this._parent._parent.myMovieClip._currentframe == 25) {
      this._parent._parent.myMovieClip.gotoAndPlay(26);
      } else {
      this._parent._parent.myMovieClip.gotoAndPlay(2);       
      this._parent._parent.resim_myMovieClip.attachMovie  ("picture1", "picture1", 1);
      }
      }
      [ -frame 25 is where it stops inside the stage, frame 26 onwards is where it plays the exiting-from-stage frames and then it goes back to the start where it enters the stage- ]

      Everything is working fine, except that the bitmaps change sooner than I want them to. From the code u can tell that once a button is clicked, the new bitmap gets attached and then it leaves the stage and then comes again to stage with the new bitmap..

      I was wondering how could I make steps in action script so that: on(release) the movieclip leaves the stage with the initial bitmap and then comes in again with the new one.

      Any help is much appreciated in advance