如何将 Flex Effects 绑定到效果目标属性?
我正在尝试重用效果。为了实现这一目标,我希望能够将一些效果的属性绑定到效果的目标。这就是我想要做的:
<mx:transitions>
<mx:Transition toState="Ready">
<mx:Parallel targets="{[b1, b2, b3]}" perElementOffset="200" duration="500">
<mx:Move xFrom="{target.x-100}" xBy="100">
<!-- possibly a fade effect too -->
</mx:Parellel>
</mx:Transition>
</mx:transitions>
<mx:VBox>
<mx:Button id="b1"/>
<mx:Button id="b2"/>
<mx:Button id="b3"/>
</mx:VBox>
上面的代码假设应用程序 createComplete 的状态更改为就绪状态。
在我对上述代码的徒劳尝试中,我尝试创建 1 个效果,该效果将为使用 VBox 布局的 3 个按钮的入口设置动画。我(试图)避免两件事:
- 绝对布局,因此手动编码坐标。我想利用容器。
- 效果代码重复
结果: - 编译器抱怨目标未定义。我试图将整个想法放入该领域,但无济于事。我试过:
- {this.target.x}
- {effectId.target.x}
- {propertyThatReturnsTheObject.x}
这可以做到吗?提前致谢。
I'm trying to reuse effects. To achieve this, i was hoping that i could bind some of the effect's properties to the effect's target. Here's what i wanted to do:
<mx:transitions>
<mx:Transition toState="Ready">
<mx:Parallel targets="{[b1, b2, b3]}" perElementOffset="200" duration="500">
<mx:Move xFrom="{target.x-100}" xBy="100">
<!-- possibly a fade effect too -->
</mx:Parellel>
</mx:Transition>
</mx:transitions>
<mx:VBox>
<mx:Button id="b1"/>
<mx:Button id="b2"/>
<mx:Button id="b3"/>
</mx:VBox>
The above code assumes, a state change on application createComplete to Ready state.
In my futile attempt with the above code, i tried to create 1 effect that would animate the entrance of 3 buttons all laid out using VBox. I'm (trying to) avoiding 2 things:
- Absolute layout hence hand coded coordinates. I want to exploit the containers.
- Effect code duplication
Results:
- Compiler complains target is not defined. I've tried to put whole list of ideas into that field but to no avail. I've tried:
- {this.target.x}
- {effectId.target.x}
- {propertyThatReturnsTheObject.x}
Can this be done? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你给移动效果一个id,你可以绑定到{moveId.target}。 目前还不清楚你的第二种情况是……
我怀疑编译器正在寻找与你认为的范围不同的目标……
当然,目标不是可绑定的属性,所以这可能是学术性的。
if you give the Move Effect an id, can you bind to {moveId.target}. Its not clear that your second case is it...
I suspect the compiler is looking for target in a different scope to the one you think it is...
Certainly, target isn't a bindable attribute, so this may be academic anyway.