动画Flex组件和旋转AS3组件之间的HitTest

时间:2012-04-27 04:15:45

标签: android actionscript-3 flex mobile air

我的应用使用AIR for Android。我创造了一个轮盘,球滚动。需要检测球与轮盘赌扇区的碰撞。同时车轮在其轴上旋转。一切正常。我结合了Flex组件和AS3组件。要注册联系我使用hitTest。

如果我通过模拟器在桌面上调试,那么一切都很好。但是当我在我的移动设备上测试我的应用程序时,hitTest仅在特定时间发生。我看到轮盘赌轮旋转得很好,球与扇区接触,但命中测试不会发生。真正的轮子旋转了我看到的其他法则。这只是在真实的设备上。

告诉我,我该如何解决?

这是我的球:

<s:BitmapImage id="pend"  smooth="true" source="@Embed('images/pend.png')"/>

这是放置扇区的轮容器,它们被创建为AS3组件:

stageW = stage.stageWidth;
stageH = stage.stageHeight; 
<mx:UIComponent id="con" mouseChildren="false" width="{stageW}" height="{stageW}" x="{stageW*0.5}" y="{stageH*0.5}"/>

我在这里要求发布部门 - https://stackoverflow.com/questions/10276336/the-text-around-the-center-of-the-circle-along-the-radius.

旋转动画。

con.rotation = rot;
if (FlexGlobals.topLevelApplication.clockwise){
 rot++;
} else {
 rot--;
}

碰撞检测:

for (var i:uint = 0; i <objArray.length; i++){
    var sector:Sector = objArray[i] as Sector;
    if (sector.hitTestPoint(pend.x + pend.width*0.5, pend.y + pend.height*0.5, true)){
        var obj:Object = new Object();
        obj.value = sector.value;
        tempArray.push(obj);
        trace (sector.value);
    }
}

0 个答案:

没有答案