2/07/2011
as3 "for" with tweener&mouse event
import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();//add Filter
import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();//add color
//_______for(起始式;條件式;步進式){區塊內敘述}
function mainClass() //create mainClass function
{
for (var i:int = 0; i < 10; i++)//i++ as i=i+1;
{
var btn:MovieClip = this["m" + i];
btn.addEventListener(MouseEvent.MOUSE_OVER, over_i);
btn.addEventListener(MouseEvent.MOUSE_OUT, out_i);
function over_i(event:MouseEvent):void{
for (var j:int = 0; j < 10; j++){
var btn:MovieClip=root["m" + j];//create btn mc
btn.buttonMode=true;//mouse mode on
Tweener.addTween(event.currentTarget, {
scaleX:1.2,//AS3: 0 to 1,1=100%
scaleY:1.2,
alpha: 0.4, //a property of the movieclip
_Blur_blurX:10,
_color:0x5A73CF,
time: 3, //required
transition: "easeOutExpo" //optional, default value is "easeOutExpo"
});}}
function out_i(event:MouseEvent):void{
for (var j:int = 0; j < 10; j++){
var btn:MovieClip=root["m" + j];
Tweener.addTween(event.currentTarget, {
scaleX:1,//AS3: 0 to 1,1=100%
scaleY:1,
_Blur_blurX:0,
_color:null,
alpha: 1, //a property of the movieclip
time: 2, //required
transition: "easeOutExpo" //optional, default value is "easeOutExpo"
});}
}
} } ;
mainClass();//execute mainClass
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment