如何创建一个以任意 Flex 组件作为参数的自定义方法?
我正在尝试编写一个自定义 fadeTo(component, x, y):void
方法,该方法将任意 Flex 组件作为参数并将其移动到给定位置,但要顺利。
我遇到的问题如下。
我想将组件本身作为参数发送,如下所示:(仅使用 Button 作为示例)
fadeTo(myButton, 200, 500) ;
(这应该将 myButton
从当前位置平滑地移动到参数指示的位置)
但是,我真的不知道类型< /strong> 任意 Flex 组件是。 我应该如何处理?
我想要一些关于如何进行的建议。
谢谢
I'm trying to write a custom fadeTo(component, x, y):void
method, which takes an arbitrary Flex Component as an argument and moves it to a given location, but smoothly.
The problem I'm running into is the following.
I want to send the component itself as argument, like this: (using Button as an example only)
fadeTo(myButton, 200, 500);
(this should move myButton
smoothly from its current position to the position indicated as parameter)
However, I don't really know what type an arbitrary Flex Component is. How should I handle that?
What I would like is some advice as to how to proceed.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 UIComponent 作为参数类型:
或者可能 IUIComponent:
如果您愿意要真正通用,您可以使用 Object 类型:
Use UIComponent as the argument type:
Or possibly IUIComponent:
If you want to be truly generic, you can use the type Object: