paint.mxml===========================================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="550" height="400" initialize="init()">
<mx:Style>
Application{
backgroundColor : #ffffff;
fontSize : 12;
}
</mx:Style>
<mx:Script>
<![CDATA[
private var thickness:Number;
private var selectedColor:uint;
private function setthickness():void
{
thickness = st1.value;
}
private function init():void
{
thickness = 5;
selectedColor = 0x000000;
st1.value = thickness;
cv1.addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
cv1.addEventListener(MouseEvent.MOUSE_UP, upHandler);
}
private function downHandler(e:MouseEvent):void
{
cv1.graphics.lineStyle(thickness, selectedColor, 1);
cv1.graphics.moveTo(this.mouseX, this.mouseY);
cv1.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
}
private function moveHandler(e:MouseEvent):void
{
cv1.graphics.lineTo(this.mouseX, this.mouseY);
}
private function upHandler(e:MouseEvent):void
{
cv1.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
}
]]>
</mx:Script>
<mx:Panel x="0" y="0" width="550" height="400" layout="absolute" title="Paintboard">
<mx:Canvas x="0" y="0" width="100%" height="100%" id="cv1">
<mx:NumericStepper x="10" y="286" minimum="1" maximum="100" stepSize="1"
change="setthickness()" id="st1"/>
</mx:Canvas>
<mx:ControlBar>
<mx:HBox width="50%">
<mx:Canvas width="50" height="22" buttonMode="true"
backgroundColor="0x0000FF" click="{selectedColor=0x0000FF}"/>
<mx:Canvas width="50" height="22" buttonMode="true"
backgroundColor="0x009900" click="{selectedColor=0x009900}"/>
<mx:Canvas width="50" height="22" buttonMode="true"
backgroundColor="0xFF0000" click="{selectedColor=0xFF0000}"/>
<mx:Canvas width="50" height="22" buttonMode="true"
backgroundColor="0xFF9933" click="{selectedColor=0xFF9933}"/>
<mx:Canvas width="50" height="22" buttonMode="true"
backgroundColor="0x000000" click="{selectedColor=0x000000}"/>
</mx:HBox>
<mx:HBox width="50%" horizontalAlign="right">
<mx:Button buttonMode="true" label="reset" click="cv1.graphics.clear()"/>
<mx:LinkButton label="Created by Shallaa" fontSize="10"
click="navigateToURL(new URLRequest('http://shallaazm.tistory.com'));"
textDecoration="underline" alpha="0.20"/>
</mx:HBox>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
=====================================================================================================
'OM' 카테고리의 다른 글
htmlconverter (0) | 2008.04.04 |
---|---|
에디트 플러스 자바설정 (0) | 2008.03.20 |
가사가 표시되는 MP3 Player (0) | 2008.03.15 |
MP3 플레이어 (0) | 2008.03.13 |
Color Balance (0) | 2008.03.13 |
컬러 팔레트를 이용한 색칠공부 (0) | 2008.02.29 |
컬러 팔레트 (0) | 2008.02.28 |
색칠공부 (4) | 2008.02.23 |
영어 학습 컨텐츠 (0) | 2008.02.22 |