您好 我试图在hud中添加一个新元素 它是一个指南针,应该像迷你地图一样运作
我已将此代码添加到主hud.swf
var DcompassContainer:MovieClip = this.createEmptyMovieClip("DcompassContainer", this.getNextHighestDepth());
DcompassContainer._x = 280;
DcompassContainer._y = 8;
DcompassContainer.loadMovie("udk_compass.swf");
到目前为止一切都很好
这是主闪光灯MC上的信息
名称方向 名称方向 标识符方向 class com.scaleform.directional
在类文件中
import flash.external.ExternalInterface;
import gfx.core.UIComponent;
class com.scaleform.directional extends UIComponent {
// The entities, layers and controls of the minimap
public var directionshow:MovieClip;
public function directional() {
//
}
public function configUI():Void {
// Register compass values with the app
//
// Params:
// compass movieclip (this),
//
ExternalInterface.call("registerDcompassView", this);
}
}
在GFxMinimapHud.uc中添加了此代码
function registerDcompassView(GFxDcompass dc)
{
GetPC().ClientMessage("DCopmass Registered");
Dcompass = dc;
Dcompass.Init(self);
Dcompass.SetVisible(false);
Dcompass.SetFloat("_xscale", 85);
Dcompass.SetFloat("_yscale", 85);
}
将所有swf添加到内容浏览器并运行游戏后swf确实出现在屏幕上 但代码不起作用 我没有得到ClientMessage