构建一个类似于 Youtube 的 Flex 音量控制组件
嘿,我被指派设计一款类似于 Youtube 播放器的 Flex 3 音量控制组件。 我的意思是,将鼠标移到音量图标上,就会出现一个垂直滑块。
我唯一的疑问是如何使这个垂直滑块正确显示和隐藏。
我应该以某种方式扩展 PopUpButton 吗? 也许是另一种 PopUp 组件? 或者我真的需要在动作脚本中对整个事情进行编程(这会很悲伤,听起来就像重新发明轮子)?
有人能简单地指出我正确的方向吗?
OBS:不需要教我有关蒙皮、设计……或其他任何事情。 :)
Hey, I've been assigned to design a flex 3 volume control component similar to the one Youtube players have. I mean, you move the mouse over the volume icon and a vertical slider appears.
My only doubt is about how making this vertical slider to appear and to hide properly.
Should I extend a PopUpButton somehow? Maybe another kind of PopUp component? Or do I really need to program the whole thing in actionscript(that would be just sad and sounds like reinventing the wheel)?
Is anyone able to simply point me in the right direction?
OBS: No need to teach me about skinning, designing.. or any of the rest. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不! 不要使用弹出窗口。 将画布放在控件栏后面隐藏的某个位置,然后将鼠标悬停在控件上时将其可见设置为 true。
我不记得 YouTube 滑块是否覆盖了音量按钮或出现在其上方,但无论哪种方式,您都可以将其与画布放在一起。
如果你希望它是一个单一的组件,你遇到的问题是,如果你将滑块隐藏在按钮组件中,尺寸将会错误(它将被测量为滑块的尺寸,而不是按钮的尺寸) 。 但别担心! 只需重写measure()并测量按钮,而不是两者都测量。 然后如果将clipContent设置为false,它可以将滑块显示在其边界之外
No! Don't use a popup. Put a canvas somewhere hidden behind your bar of controls and just set it's visible to true when you mouse over the control.
I don't remember if the youtube slider covers the volume button or appears above it, but either way you can put it in there with a canvas.
If you want it to be one single component, the problem you run in to is that the size will be wrong if you hide the slider in the button component (It will be measured to be the size of the slider, instead of the button). But don't worry! Just override measure() and measure the button instead of both. Then if you set clipContent to false, it can display the slider outside of its bounds
我的建议是创建一个 Flex 控件,其中包含用于显示音量计的图形和隐藏的滑块。
当您将鼠标悬停在图形音量计上时,您会显示滑块。
当您滚动滑块或音量计时,您会隐藏滑块。
我相信仅此而已
What I suggest is to create a flex control that contains a graphic for displaying the volume meter and a hidden slider.
When you roll over the graphic volume meter you show the slider.
When you roll out the slider or the volume meter then you hide the slider.
I believe that's all