| 1 |
package code |
| 2 |
{ |
| 3 |
/***************************************** |
| 4 |
* based on textmate actionscript bundle |
| 5 |
****************************************/ |
| 6 |
|
| 7 |
import fl.events.SliderEvent; |
| 8 |
|
| 9 |
public class Foo extends MovieClip |
| 10 |
{ |
| 11 |
//************************* |
| 12 |
// Properties: |
| 13 |
|
| 14 |
public var activeSwatch:MovieClip; |
| 15 |
|
| 16 |
// Color offsets |
| 17 |
public var c1:Number = 0; // R |
| 18 |
|
| 19 |
//************************* |
| 20 |
// Constructor: |
| 21 |
|
| 22 |
public function Foo() |
| 23 |
{ |
| 24 |
// Respond to mouse events |
| 25 |
swatch1_btn.addEventListener(MouseEvent.CLICK,swatchHandler,false,0,false); |
| 26 |
previewBox_btn.addEventListener(MouseEvent.MOUSE_DOWN,dragPressHandler); |
| 27 |
|
| 28 |
// Respond to drag events |
| 29 |
red_slider.addEventListener(SliderEvent.THUMB_DRAG,sliderHandler); |
| 30 |
|
| 31 |
// Draw a frame later |
| 32 |
addEventListener(Event.ENTER_FRAME,draw); |
| 33 |
} |
| 34 |
|
| 35 |
protected function clickHandler(event:MouseEvent):void |
| 36 |
{ |
| 37 |
car.transform.colorTransform = new ColorTransform(0,0,0,1,c1,c2,c3); |
| 38 |
} |
| 39 |
|
| 40 |
protected function changeRGBHandler(event:Event):void |
| 41 |
{ |
| 42 |
c1 = Number(c1_txt.text); |
| 43 |
|
| 44 |
if(!(c1>=0)){ |
| 45 |
c1 = 0; |
| 46 |
} |
| 47 |
|
| 48 |
updateSliders(); |
| 49 |
} |
| 50 |
} |
| 51 |
} |