Created
March 14, 2013 02:41
-
-
Save sonygod/5158399 to your computer and use it in GitHub Desktop.
Test haxe3 swc for as3 just Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created with IntelliJ IDEA. | |
* User: p5 | |
* Date: 13-1-31 | |
* Time: 下午8:00 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
package { | |
import flash.display.MovieClip; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
import flash.system.Security; | |
import flash.system.System; | |
import flash.text.TextField; | |
import flash.utils.ByteArray; | |
import flash.utils.getTimer; | |
import flash.utils.setInterval; | |
import flash.external.ExternalInterface; | |
import haxe; | |
import Lambda; | |
import haxe.Log; | |
public class Main extends MovieClip{ | |
private var a:uint=1; | |
public var t:TextField=new TextField(); | |
public function Main() { | |
if (!stage) | |
addEventListener(Event.ADDED_TO_STAGE, onAddToStage); | |
else | |
onAddToStage(); | |
} | |
private function onAddToStage(event:Event = null):void { | |
haxe["initSwc"](this) | |
} | |
public static function main():void { | |
Array2.init(); | |
var arr:Array=[1,2,3,4,5,6] | |
trace(Lambda.count(arr)); | |
trace(Lambda.empty(arr)) | |
trace(Lambda.has(arr,2)) | |
trace(Lambda.exists(arr,function(x:int):Boolean{return x<10;})) | |
trace(Lambda.foreach(arr,function(x:int):Boolean{return x>5;})) | |
var isEvent : Function = function(num : int) : Boolean { | |
return Math.floor(num / 2) == num / 2; | |
} | |
trace(arr["filterHX"](isEvent)); | |
var sum = function(num, total) { return total += num ; }; | |
trace(Lambda.fold(arr,sum,0)) ; | |
arr.insert(0,10000) | |
arr.remove(1) | |
trace(arr) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment