최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday

티스토리 뷰

over했을때 color속성이 바뀌고, out 했을 때에는 원본의 color속성으로 되돌아 올때는 다음과 같이.

 

소스) 

import caurina.transitions.*;
import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();

var simpleSprite:Sprite = new Sprite();
simpleSprite.graphics.lineStyle();
simpleSprite.graphics.beginFill(0xff0000);
simpleSprite.graphics.drawRect(0,0,200,100);

addChild(simpleSprite);
simpleSprite.x = (stage.stageWidth - simpleSprite.width)/2
simpleSprite.y = (stage.stageHeight - simpleSprite.height)/2
simpleSprite.buttonMode = true;
 
simpleSprite.addEventListener(MouseEvent.MOUSE_OVER, makeBlue);
simpleSprite.addEventListener(MouseEvent.MOUSE_OUT, makeRed);
simpleSprite.addEventListener(MouseEvent.CLICK, makeBlack);
 
function makeBlue(e:MouseEvent):void{
  Tweener.addTween(simpleSprite, {_color:0x0000ff, time:1, transition:"easeOutQuart"});
}
function makeRed(e:MouseEvent):void{
  Tweener.addTween(simpleSprite, {_color:null, time:1, transition:"easeOutQuart"});
}
function makeBlack(e:MouseEvent):void{
  Tweener.addTween(simpleSprite, {_color:0x000000, time:1, transition:"easeOutQuart"});
}

 


마우스 오버전: 빨강 / 마우스  오버 : 파랑 / 마우스  클릭 : 검정 / 아웃: 빨강

 

댓글