# Help tweaking tweening with code tutorial

**URL:** https://forum.kirupa.com/t/help-tweaking-tweening-with-code-tutorial/300022
**Category:** Uncategorized
**Created:** [November 14, 2009, 3:52pm UTC](https://forum.kirupa.com/t/help-tweaking-tweening-with-code-tutorial/300022 "2009-11-14T15:52:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![steviespin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/steviespin/32/657_2.png) [@steviespin](https://forum.kirupa.com/u/steviespin)
#### Post date: [November 14, 2009, 3:52pm UTC](https://forum.kirupa.com/t/help-tweaking-tweening-with-code-tutorial/300022/1 "2009-11-14T15:52:56Z")

</div>

Hi there!

Below is the code from the site’s tutorial on how to animate with code using a mouse click. I’d like to add to this and could really use some help!How could you assign different destinations for, say, 4 objects, each assigned to a different button.

ie button 1: animate the 4 elements to location set 1  
button 2: animate the 4 elements to location set 2  
and so on…

I know it’s probably an easy edit but I need help - thanks!!

S

[SIZE=1]import fl.transitions.Tween; [/SIZE][SIZE=1]import fl.transitions.TweenEvent; [/SIZE][SIZE=1]import fl.transitions.easing.\*; [/SIZE][SIZE=1] [/SIZE][SIZE=1]var xMovement:Tween; [/SIZE][SIZE=1]var yMovement:Tween;[/SIZE] [SIZE=1] [/SIZE][SIZE=1] [/SIZE][SIZE=1]function Start():void {[/SIZE] [SIZE=1]stage.addEventListener(MouseEvent.CLICK, moveToClick);[/SIZE][SIZE=1]}[/SIZE] [SIZE=1] [/SIZE][SIZE=1]function moveToClick(event:MouseEvent):void {[/SIZE] [SIZE=1] [/SIZE][SIZE=1]xMovement = new Tween(tweenMC, “x”, Back.easeIn, tweenMC.x, mouseX, 1, true); [/SIZE][SIZE=1]yMovement = new Tween(tweenMC, “y”, Back.easeIn, tweenMC.y, mouseY, 1, true);[/SIZE][SIZE=1]}[/SIZE] [SIZE=1] [/SIZE][SIZE=1]Start();[/SIZE]
