starling/core/Starling.as
case TouchEvent.TOUCH_END: phase = TouchPhase.ENDED; break;
case MouseEvent.MOUSE_DOWN: phase = TouchPhase.BEGAN; break;
case MouseEvent.MOUSE_UP: phase = TouchPhase.ENDED; break;
+ case MouseEvent.RIGHT_MOUSE_DOWN: phase = TouchPhase.RIGHT_BEGAN; break;
+ case MouseEvent.RIGHT_MOUSE_UP: phase = TouchPhase.RIGHT_ENDED; break;
case MouseEvent.MOUSE_MOVE:
phase = (mLeftMouseDown ? TouchPhase.MOVED : TouchPhase.HOVER); break;
}
...
...
...
if (!multitouchEnabled || Mouse.supportsCursor)
- types.push(MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_MOVE, MouseEvent.MOUSE_UP);
+ types.push(MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_MOVE, MouseEvent.MOUSE_UP, MouseEvent.RIGHT_MOUSE_DOWN, MouseEvent.RIGHT_MOUSE_UP);
return types;
}
starling/events/TouchPhase.as
public static const HOVER:String = "hover";
+
+ /** Only available for mouse input: right mouse button was pressed */
+ public static var RIGHT_BEGAN : String = "right_began"
+
+ /** Only available for mouse input: right mouse button was released */
+ public static const RIGHT_ENDED : String = "right_ended";
/** The finger touched the screen just now, or the mouse button was pressed. */
public static const BEGAN:String = "began";
starling right click
as3 get radians between three point
// Center point is p1; angle returned in radians
function findAngle(p0:Point,p1:Point,p2:Point) {
var a = Math.pow(p1.x-p0.x,2) + Math.pow(p1.y-p0.y,2),
b = Math.pow(p1.x-p2.x,2) + Math.pow(p1.y-p2.y,2),
c = Math.pow(p2.x-p0.x,2) + Math.pow(p2.y-p0.y,2);
return Math.acos( (a+b-c) / Math.sqrt(4*a*b) );
}
as3 radians to degrees
var degrees:Number = radians*180/Math.PI ;
AS3 String to Boolean
var boolValue:Boolean = (boolString == "true") ? true : false;
just one line! I like it!
old mac install win64bit
http://www.iruberleet.org/2011/10/12/fixing-select-cd-rom-boot-type-when-installing-64bit-windows/
air for mobile device keep awake
it’s very easy to make the device stay awake. First you need to enable the following two permissions in the -app.xml file:
<uses-permission android:name="android.permission.WAKE_LOCK">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD">
</uses-permission></uses-permission>
Then you need to use this simple line of code anytime you want to keep the device awake:
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
To enable the device to go to sleep again:
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
as3 text to speech
var req:URLRequest= new URLRequest( "http://translate.google.com/translate_tts
?ie=UTF-8&tl=zh-TW&q=" + encodeURI("中文"));
var snd:Sound = new Sound(req);
snd.play();
