3 Replies Latest reply on Jan 23, 2007 12:43 PM by MotionMaker

    Help!! Having Issue with animating MovieClip in Actionscript

    kennyred
      Hello to all my favorite forum folks!

      I have been using flash for a few years, on and off and have used the forums successfully for many issues I couldn't resolve.

      Essentially I have a 3 layer Flash file.
      First layer being actions, second is my Navigation (just text right now) and third is my photo (which is being used as a movie clip)

      I am wanting to animate the photo from one xy coordinate to another using the same navigation button. I tried using frame labels and the gotoAndPlay function but I have had problems with this in the past and it just won't work.

      Does anyone have any piece of code which I could use that would use a if/else statement to animate to certain xy coordinates.

      I've been trying diferent things that have been posted on the forums to no avail. If anyone can help it would be appreciated. Thanks!
        • 1. Re: Help!! Having Issue with animating MovieClip in Actionscript
          kglad Adobe Community Professional & MVP
          your button needs to initiate a loop (setInterval() will work) that repeatedly changes the movieclips _x,_y properties towards a designated endpoint. when the movieclip is close enough to the endpoint the loop terminates.
          • 2. Re: Help!! Having Issue with animating MovieClip in Actionscript
            kennyred Level 1
            so exactly how should I write the code? my current code, (which i think is a little screwed up and not cleaned up) is this,

            _root.onEnterFrame = function () {if (this.desk_mc._currentframe =
            "mtopens,mtokeyboard,keyboardtom,keyboardtopens,penstom,penstokeyboard" )
            {this.portfolio_btn.onRelease = this.desk_mc.gotoAndPlay("mtokeyboard");}else{stop();
            }
            }


            sorry, about the messy code, I was self taught and just kinda figured out how to do this by reading on the forums.
            • 3. Re: Help!! Having Issue with animating MovieClip in Actionscript
              MotionMaker Level 1
              You have a lot of choices:

              1. You can use a static tween to go from one set of xy to another for a photo. This is simply using the Flash timeline in authoring mode where you place the object on a layer on a key frame. Add a second keyframe where the animation stops and set properties on the first keyframe to motion tween. I would place the photo in a MovieClip if you want an alpha change or add more to it.

              2. You can use an onEnterFrame method for an instance of a MovieClip and change the _x _y coordinates using math or a data list each time the method runs. Another variation on this is setInterval to call a function to perform the change in _x and _y

              3. You can use the Tween classes and two tween objects for each of the _x and _y properties of the MovieClip containing the photo.

              A more elaborate example of AS Tween Class.

              Basic Tween class code: