|
|
//First you need to import the necessary tweening and easing class
import mx.transitions.Tween;
import mx.transitions.easing.*;
/*Now for the example I will assume you have given the buttons inside your menu movieclip the following instance names: btn1, btn2, btn3, btn4 AND you the menu mc an instance name: menu*/
//First I'll store the coordinates you want the menu to move to, for each button
var x1:Number = 0;
var y1:Number = 0;
var x2:Number = 500;
var y2:Number = 0;
var x3:Number = 500;
var y3:Number = 500;
var x4:Number = 0;
var y4:Number = 500;
//Now make an onrelease event for each button
menu.btn1.onRelease = function()
{
//Move the menu from where it is now (x-coordinate: menu._x and y-ccordinate: menu._y) to the x1 and y1 coordinates
//First x-ccord
var twX:Tween = new Tween(menu, "_x", Strong.easeOut, menu._x, x1, 1, true);
//y-coord
var twY:Tween = new Tween(menu, "_y", Strong.easeOut, menu._y, y1, 1, true);
}
menu.btn2.onRelease = function()
{
//First x-ccord
var twX:Tween = new Tween(menu, "_x", Strong.easeOut, menu._x, x2, 1, true);
//y-coord
var twY:Tween = new Tween(menu, "_y", Strong.easeOut, menu._y, y2, 1, true);
}
menu.btn3.onRelease = function()
{
//First x-ccord
var twX:Tween = new Tween(menu, "_x", Strong.easeOut, menu._x, x3, 1, true);
//y-coord
var twY:Tween = new Tween(menu, "_y", Strong.easeOut, menu._y, y3, 1, true);
}
menu.btn4.onRelease = function()
{
//First x-ccord
var twX:Tween = new Tween(menu, "_x", Strong.easeOut, menu._x, x4, 1, true);
//y-coord
var twY:Tween = new Tween(menu, "_y", Strong.easeOut, menu._y, y4, 1, true);
}
|