【发布时间】:2017-01-22 09:52:29
【问题描述】:
我正在使用 AIR for android 和 Starling 框架开发游戏。我使用 Flash CC 作为 IDE。当我在 Flash 中测试 i 时它工作正常,但是当我将它发布到 android 时它不能正常工作。
我有一个屏幕管理器类,它隐藏和显示菜单、关卡选择和游戏屏幕。为此,我有一个自定义事件类。下面的函数在屏幕管理器类中。它适用于每个目标值,但 不适用于 TO_GAME。
private function onNavigate(e: NavEvent)
{
if (e.destination == Destination.TO_HOME)
{
menuScreen.wake();
}
else if (e.destination == Destination.TO_LEVELS)
{
levelScreen.wake();
}
else if (e.destination == Destination.TO_GAME)
{
gameScreen.wake();
}
else if (e.destination == Destination.TO_HELP)
{
helpScreen.wake();
}
else if (e.destination == Destination.TO_ABOUT)
{
aboutScreen.wake();
}
}
当用户点击一个关卡按钮时触发he事件。见其他部分
var btn:Button = e.target as Button;
if (btn == backBtn)
{
this.dispatchEvent(new NavEvent(NavEvent.NAVIGATE , Destination.TO_HOME));
this.sleep();
}
else
{
//just testing if I can get the level number from the position of the level button
trace(this.getLevelNumber(btn.x,btn.y));
this.dispatchEvent(new NavEvent(NavEvent.NAVIGATE , Destination.TO_GAME));
this.sleep();
}
我从不同的按钮触发了这个事件,但到目前为止还没有运气。它在他的 IDE 中工作,但设备内部没有任何反应。所有其他事件都在工作。事件上述函数中的第一个条件工作正常。
【问题讨论】:
标签: android actionscript-3 flash events air