A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] animated moving movie clip with actionscript 2.0

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Location
    MI
    Posts
    279

    resolved [RESOLVED] animated moving movie clip with actionscript 2.0

    I have a movie clip that needs to move to a location when a button is pressed. I need the movement to be animated rather then just jump to the location. I think it would have something to do with affecting the movieclips _x and _y but i can't figure out how to make it animated.
    Our greatest fear is not that we are inadequate,
    but that we are powerful beyond measure.

  2. #2
    you could animate it by hand on the timeline add a stop to the first frame and the end frame, and when you would like to have the animation start just add

    myButtonName.onRelease = function ():Void { animationName.play(); }

    that works well if it is only ever going to animation to one position, if you want it to go to a different position, you can do it with code using a Tween Library. There is one built into flash, but I always use third party engines. One of the more popular ones is GreenSock TweenLite. It is very simple and they have examples on their site (http://www.greensock.com/tweenlite/)

  3. #3
    Senior Member
    Join Date
    Mar 2005
    Location
    MI
    Posts
    279
    The movie clip is moving to one of five locations, i would rather use just action script. I know it can be done i just don't know quite how to do it.
    Our greatest fear is not that we are inadequate,
    but that we are powerful beyond measure.

  4. #4
    like i said, check out the greensock site. they have examples and a little tool to help you through it

  5. #5
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Give your movieclip an instance name of mc, and use this code on your frame:

    Actionscript Code:
    speed = 10; // the higher the slower

    mc.onEnterFrame = function(){
        this._x += (mouseX - this._x)/speed;
        this._y += (mouseY - this._y)/speed;
    }

    onMouseDown = function(){
        mouseX = _root._xmouse;
        mouseY = _root._ymouse;
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  6. #6
    Senior Member
    Join Date
    Mar 2005
    Location
    MI
    Posts
    279
    Thanks Nig 13, can you explain how to use it? how is it activated when i click a button?
    Our greatest fear is not that we are inadequate,
    but that we are powerful beyond measure.

  7. #7
    Senior Member
    Join Date
    Mar 2005
    Location
    MI
    Posts
    279
    Never mind i figured it out.
    Our greatest fear is not that we are inadequate,
    but that we are powerful beyond measure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center