检测一个影片剪辑被水平翻转在AS3舞台 [英] Detecting a movieclip has been Flipped horizontally on the stage in as3
问题描述
如果同一个影片剪辑的两个影片剪辑实例放置在舞台上,一个被水平翻转在Flash ..有没有一种方法可以让我发现其中一个已经在code水平被翻转?的ScaleX似乎保持不变。
If two movie clips instances of the same movieclip are placed on the stage and one is flipped horizontally in Flash.. Is there a way I can detect which one has been flipped horizontally in code? ScaleX seems to remain unchanged.
在影片剪辑已水平翻转使用Flash UI(编辑 - >水平翻转),而不是通过code。
The MovieClip has been flipped horizontally using the Flash UI (Edit->Flip Horizontal), not via code.
推荐答案
尝试:
function isFlippedHorizontally( obj:DisplayObject ):Boolean
{
return obj.transform.matrix.a / obj.scaleX == -1;
}
trace( isFlippedHorizontally( yourObject ) );
编辑:
我应该占到的scaleX
的对象;现在的调整。
edit:
I should have accounted for the scaleX
of the object; adjusted now.
或者
import fl.motion.MatrixTransformer;
function isFlippedHorizontally( obj:DisplayObject ):Boolean
{
return MatrixTransformer.getSkewYRadians( obj.transform.matrix ) / Math.PI == 1;
}
trace( isFlippedHorizontally( yourObject ) );
编辑:
最后一个例子小心了计算垂直翻转的水平翻转代替。
edit:
Last example accidentally had calculation for vertically flipped in stead of horizontally flipped.
这篇关于检测一个影片剪辑被水平翻转在AS3舞台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!