for (i in 0...5) {
trace(i);
}
output: 0,1,2,3,4
如果今天要改成
4,3,2,1,0
通常我會用 while
var i=5;
while (i-->0) {
trace(i);
}
一定要用 for 的話
for (i in -5...0) {
trace(-i-1);
}
for (i in 0...5) {
trace(i);
}
output: 0,1,2,3,4
如果今天要改成
4,3,2,1,0
通常我會用 while
var i=5;
while (i-->0) {
trace(i);
}
一定要用 for 的話
for (i in -5...0) {
trace(-i-1);
}
static public const OFFSET_Y:Int = 100;
static inline public var OFFSET_Y:Int = 100;
static inline var OFFSET_Y:Int = 100;
用 echo
輸出來看看最準..XD
<echo value="Using iPhone SDK ${IPHONE_VER}" if="VERBOSE"/>
一般是輸出到螢幕,
如果想改成輸出到 flashlog.txt
有兩種方式。
第一種: 用內建的 trace
flash.Lib.trace('hello world')
第二種: 開啟 fdb
<haxedef name="fdb" if="flash" />
跟 as 用法一樣,基本上沒什麼問題。
記得要指定 request.method = URLRequestMethod.POST
不然會音訊全無..
開啟 verbose
,真的很好用。
request.verbose = true;
#if cpp
var variables:URLVariables = new URLVariables();
variables.Name = "isobar";
variables.Parameter = Json.stringify(obj); // json
var request:URLRequest = new URLRequest(Config.BASE_URL + __api);
request.verbose = true;
request.method = URLRequestMethod.POST;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, function(e:Event) {
trace("e:"+e.target.data.toString());
});
loader.load(request);
#end