当我补间两个对象时,为什么我所做的补间会有所不同?
我在 y = -20;
处有一个 TextField 和一个 Sprite,并且它们位于正确的位置。
然后我做这个补间。
Tweener.addTween(t, {y: 20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 20, time:0.5, onComplete:Hold, transition:"linear"});
(t 是 TextField,noteBar 是 Sprite)
当我这样做时,Sprite 会变成 y = 0;但 TextField 变为 y = 20;
如果我将 TextField y 设置为 0,将 Sprite y 设置为 20,则它可以正常工作。
但是我需要执行此操作才能将它们恢复到原始位置。
Tweener.addTween(t, {y: -20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 0, time:0.5, transition:"linear"});
因为如果我让 Sprite 去 -20 那么它最终会变成 y = -40;
为什么会这样呢?
I have a TextField and a Sprite both at y = -20;
and they are in the correct position.
Then I do this tween.
Tweener.addTween(t, {y: 20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 20, time:0.5, onComplete:Hold, transition:"linear"});
(t is the TextField and noteBar is the Sprite)
What happens when I do this is that the Sprite goes to y = 0; but the TextField goes to y = 20;
It works correctly if I have the TextField y at 0 and the Sprite y at 20.
But then I need to do this to get them back into the original position.
Tweener.addTween(t, {y: -20, time:0.5, transition:"linear"});
Tweener.addTween(noteBar, {y: 0, time:0.5, transition:"linear"});
Because if I let the Sprite go -20 then it will end up at y = -40;
Why does it act this way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您说“两者都在 y=-20”时,您是否使用 Flash 中的信息调色板来确定这一点?
我问这个问题是因为信息调色板有两种显示 x、y 的模式:注册和转换。通过单击信息面板中 X 字段左侧的小注册点图标可以切换此功能。
问题是,在转换模式下,显示的 x,y 将是文本字段的中心,但实际上,文本字段的 x,y 是左上角。
因此,简短的答案是确保信息调色板处于注册模式(带有十字线的图标),然后将文本字段设置为 -20。
另一种解决方案是将 TextField 包装在 sprite 中,使其行为方式与 NoteBar 相同,在这种情况下,信息调色板处于什么模式并不重要。
当然,如果您在代码中完成这一切,而不是定位Flash 中的项目,我的解决方案没有实际意义。
-加布里埃尔
When you say that "both are at y=-20", are you using the info palette in Flash to determine this?
I ask because the info palette has two modes for displaying the x,y: Registration and Transformation. This is toggled by clicking on the small registration point icon to the left of the X field in the info palette.
The problem is that in Transformation mode, the x,y displayed will be the CENTER of the textfield, but in reality, the x,y of a text field is the top left.
So, the short answer is to make sure the info palette is in Registration mode (the icon with the cross-hair) then put the text field at -20.
Another solution would be to wrap the TextField in a sprite so that it behaves the same way as NoteBar, in which case it doesn't matter what mode the info palette is in.
Of course if you are doing this all in code, not positioning the items in Flash, my solution is moot.
-Gabriel