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