검색결과 리스트
언어/ActionScript 3.0에 해당되는 글 2건
- 2009/04/10 회전하면서 가속도 (5)
- 2008/10/18 flex와 actionscript (14)
글
회전하면서 가속도
언어/ActionScript 3.0
2009/04/10 18:43
점점 미친듯이 회전.
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="800", height="600", backgroundColor="#ffffff", framerate="30")]
public class oscillation extends Sprite
{
private var _sprite:Sprite;
private var _angle:Number = 0;
private var _xRadius:Number = 100;
private var _yRadius:Number = 100;
private var _vx:Number = 0;
private var _vy:Number = 0;
private var _ax:Number = .02;
private var _ay:Number = .2;
public function oscillation()
{
_sprite = new Sprite();
_sprite.graphics.beginFill(0x0000ff, 100);
_sprite.graphics.drawCircle(0, 0, 25);
_sprite.graphics.endFill();
_sprite.x = 0;
_sprite.y = 100;
addChild(_sprite);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void
{
_sprite.x = 200 + Math.sin(_angle) * _xRadius;
_sprite.y = 200 + Math.cos(_angle) * _yRadius;
_ax += .01;
_angle += _ax;
}
}
}
수학적 머리가 나빠서 힘드네요 하악.
하고싶은건 이게 아닌데;ㅁ;
글
flex와 actionscript
언어/ActionScript 3.0
2008/10/18 19:35
초 간단한 마우스로 선그리기 예제.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="test()">
<mx:Script>
<![CDATA[
public function test():void
{
can.addEventListener(MouseEvent.MOUSE_DOWN, mouseDHandler);
can.addEventListener(MouseEvent.MOUSE_UP, mouseUHandler);
can.addEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseDHandler(ent:Event):void
{
can.graphics.lineStyle(5, 1, 1, true);
can.graphics.moveTo(can.mouseX, can.mouseY);
can.addEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseUHandler(ent:Event):void
{
can.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseMHandler(ent:Event):void
{
draw(can.mouseX, can.mouseY);
}
private function draw(x:int, y:int):void
{
can.graphics.lineTo(x, y);
}
]]>
</mx:Script>
<mx:Panel id="pnl" x="10" y="10" width="398" height="369" layout="absolute">
<mx:Canvas x="0" y="0" width="378" height="329" id="can">
</mx:Canvas>
</mx:Panel>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="test()">
<mx:Script>
<![CDATA[
public function test():void
{
can.addEventListener(MouseEvent.MOUSE_DOWN, mouseDHandler);
can.addEventListener(MouseEvent.MOUSE_UP, mouseUHandler);
can.addEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseDHandler(ent:Event):void
{
can.graphics.lineStyle(5, 1, 1, true);
can.graphics.moveTo(can.mouseX, can.mouseY);
can.addEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseUHandler(ent:Event):void
{
can.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMHandler);
}
private function mouseMHandler(ent:Event):void
{
draw(can.mouseX, can.mouseY);
}
private function draw(x:int, y:int):void
{
can.graphics.lineTo(x, y);
}
]]>
</mx:Script>
<mx:Panel id="pnl" x="10" y="10" width="398" height="369" layout="absolute">
<mx:Canvas x="0" y="0" width="378" height="329" id="can">
</mx:Canvas>
</mx:Panel>
</mx:Application>
"와서 이미지 에디터 개발해볼래요?" 한마디에 " 네!!!!!!!! " 하고 달려온 회사.
(아.. 오가는 대화는 더 많았다는 ㅡ0ㅡ)
flex개발을 하기 위해 2주동안 안돌아가는 머리로 힘들었습니다..
도대체가 이건 어떻게 되는건지 이해가 안되서, 저렇게 간단한 선 그리기 예제를,
이제서야 술술 코딩하게 되었습니다. 아직 많은게 부족하지만,
TNC에서 개발해보고싶었던 이미지 에디터, 그림판 같은 프로그램들의 개발을 열심히 해봐야겠어용..
왜냐하면.. 전 소중하니까요. ㅋ ㅑ~ ㅋㅋㅋ
새로운걸 배우는건 재미있고 신나네용.. 열심히 해야겠어요 잇힝~♡