Skip to content

Commit 5ad224f

Browse files
committed
changing line endings for git
1 parent a3a9863 commit 5ad224f

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed
+63-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,63 @@
1-
package{ import flash.desktop.NativeApplication; import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; public class VectorHWAExample extends MovieClip { public function VectorHWAExample() { //listens for when the application looses focus NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate); addEventListener(Event.ADDED, onAddedToStage); } private function onAddedToStage(e:Event):void { removeEventListener(Event.ADDED, onAddedToStage); addEventListener(Event.ENTER_FRAME, onEnterFrame); stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); } //called when application looses focus private function onDeactivate(e:Event):void { //close the application //we could put some code on here to no close if running on the desktop NativeApplication.nativeApplication.exit(); } private var mouseIsDown:Boolean = false; private function onMouseDown(e:MouseEvent):void { mouseIsDown = true; } private function onMouseUp(e:MouseEvent):void { mouseIsDown = false; } private function onEnterFrame(e:Event):void { if(!mouseIsDown) { return; } var s:Square = new Square(); s.x = stage.mouseX; s.y = stage.mouseY; addChild(s); } } }
1+
package
2+
{
3+
import flash.desktop.NativeApplication;
4+
import flash.display.MovieClip;
5+
import flash.events.Event;
6+
import flash.events.MouseEvent;
7+
8+
9+
public class VectorHWAExample extends MovieClip
10+
{
11+
12+
public function VectorHWAExample()
13+
{
14+
//listens for when the application looses focus
15+
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate);
16+
addEventListener(Event.ADDED, onAddedToStage);
17+
}
18+
19+
private function onAddedToStage(e:Event):void
20+
{
21+
removeEventListener(Event.ADDED, onAddedToStage);
22+
addEventListener(Event.ENTER_FRAME, onEnterFrame);
23+
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
24+
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
25+
}
26+
27+
//called when application looses focus
28+
private function onDeactivate(e:Event):void
29+
{
30+
//close the application
31+
//we could put some code on here to no close if running on the desktop
32+
NativeApplication.nativeApplication.exit();
33+
}
34+
35+
private var mouseIsDown:Boolean = false;
36+
private function onMouseDown(e:MouseEvent):void
37+
{
38+
mouseIsDown = true;
39+
}
40+
41+
private function onMouseUp(e:MouseEvent):void
42+
{
43+
mouseIsDown = false;
44+
}
45+
46+
private function onEnterFrame(e:Event):void
47+
{
48+
if(!mouseIsDown)
49+
{
50+
return;
51+
}
52+
53+
var s:Square = new Square();
54+
s.x = stage.mouseX;
55+
s.y = stage.mouseY;
56+
57+
addChild(s);
58+
}
59+
60+
61+
}
62+
63+
}

0 commit comments

Comments
 (0)