Friday 28 September 2012

More flash code!: mx transitions


Learning more about flash actionscript 2:



today we used some code that given a movieclip some transition tween, with easein and easeout





Please ignore some of the code as it will not all apply to the project actually working or not.





import mx.transitions.Tween;
import mx.transitions.easing.*;


function easein1()
{
 new Tween(button1, "_xscale", Elastic.easeOut, 100, 200, 2, true);
 new Tween(button1, "_yscale", Elastic.easeOut, 100, 200, 2, true);
}
function easeout1()
{
 new Tween(button1, "_xscale", Elastic.easeOut, 200, 100, 2, true);
 new Tween(button1, "_yscale", Elastic.easeOut, 200, 100, 2, true);
}


button1.onRollOver = easein1;
button1.onRollOut = easeout1;

function easein2()
{
 new Tween(button2, "_xscale", Bounce.easeOut, 100, 200, 1, true);
 new Tween(button2, "_yscale", Bounce.easeOut, 100, 200, 1, true);
}
function easeout2()
{
 new Tween(button2, "_xscale", Bounce.easeOut, 200, 100, 1, true);
 new Tween(button2, "_yscale", Bounce.easeOut, 200, 100, 1, true);
}



//this bit below is the
//thing you roll over or off of to make something else move!
box.onRollOver = easein2;
box.onRollOut = easeout2;










The "//" was just used to describe what happens when the code is used the "//" won't affect the code in anyway and is not needed.

No comments:

Post a Comment