0
編譯我的代碼到一個程序,什麼都不做的SWF文件的結果。我期待一個顏色爲#FFAA00的純色矩形。爲什麼我的代碼沒有做任何事情?的ActionScript 3/MXML:我的代碼沒有做任何事情
dummy.as:
//Dependencies
import flash.display.*;
import flash.events.*;
//Variables
var GlobalTimer:int = 0;
var Rect:Shape = new Shape();
//Game loader function
public function handle():void
{
init();
}
//Init function
public function init():void
{
addChild(Rect);
addEventListener(Event.ENTER_FRAME,loop);
}
//Loop function
public function loop(event:Event):void
{
var CurTimer:int = getTimer();
var FrameDiff:int = CurTimer-GlobalTimer;
GlobalTimer = CurTimer;
Rect.graphics.beginFill(0xFFAA00);
Rect.graphics.drawRect(0,0,640,480);
Rect.graphics.endFill();
}
dummy.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application width="640" height="480" xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="handle()">
<mx:Script source="dummy.as"/>
</mx:Application>
編譯使用:
./mxmlc ../../feedsparky/src/dummy/dummy.mxml
一些代碼將是很好的。 – Yoshimaster
@Yoshimaster您無法創建某個類的實例並將其添加爲中間容器? Okaaay ... – Organis
就是這樣?對不起,我有點困惑。我不經常使用OOP語言,因此並不真正瞭解術語。基本上,我不明白你的意思。 – Yoshimaster