开发者

Flex TouchEvent stageX & stageY properties fluctuate under transformed target

I've written code that enables DisplayObjects to be fully manipulated under two touch points (drag, scale, rotate).

The problem I'm having is that as the DisplayObject is being manipulated, it causes fluctua开发者_JS百科tions in the TouchEvent's stageX & stageY properties. These fluctuations are feeding back into the tranformation code and as a result, the object shakes/shivers.

It seems that the stageX & stageY properties are being calculated from the localX & localY properties of the TouchEvent.

I've tried adding listening to the stage itself for the TouchMove event, but as soon as I drag my finger over a transformed object, the traced stageX & stageY values change slightly, going from integers to floating-point numbers. This is evidently what's causing the shakey feedback loop.

Has anyone had any experience with this? Any advice on avoiding this problem would be greatly appreciated.

Thanks,

Tim


Ok, I solved it. The shivering effect is being caused by the stageX & stageY values changing from integers to floating point numbers as the targets are transformed on the stage. Each change causes a minute feedback loop causing the shiver. I remedied this by simply using Math.float() to convert the values to integers before using them in my calculations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜