티스토리 뷰

Language/Flash

무비클립 색 변경

MiniNeko 2015. 11. 29. 04:22

import flash.geom.ColorTransform;
import flash.geom.Transform;
 
var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(car_mc);
trans.colorTransform = colorTrans;
 
blue_btn.onRelease = function() {
    colorTrans.rgb = 0x333399; // blue
    trans.colorTransform = colorTrans;
};
red_btn.onRelease = function() {
    colorTrans.rgb = 0xFF0000; // red
    trans.colorTransform = colorTrans;
};
green_btn.onRelease = function() {
    colorTrans.rgb = 0x006600; // green
    trans.colorTransform = colorTrans;
};
black_btn.onRelease = function() {
    colorTrans.rgb = 0x000000; // black
    trans.colorTransform = colorTrans;
};
 
--------------------------
 
car_mc와 blue_btn등 버튼은 스테이지에 놓여있는 무비클립
색변화에 대한 기본적 형태
 
Flash Player 8부터는 Color 클래스가 사용되지 않으므로
대신 flash.geom.ColorTransform 클래스를 사용하라고 권장하고 있다. 

Total
Today
Yesterday
최근에 올라온 글
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28