如何在 Flex 中管理不规则按钮形状上的鼠标点击
在 Flex 中,我尝试设计 3 个与上传的图像类似的按钮 http://www.freeimagehosting.net/uploads/f14d58b49e.jpg
鼠标悬停/单击图像应仅适用于按钮的红色区域。 如何在 Flex 中管理鼠标点击或不规则按钮形状?
谢谢...阿图尔
In Flex, I am trying to design 3 buttons similar to the image uploaded at
http://www.freeimagehosting.net/uploads/f14d58b49e.jpg
The mouse over/click on image should work only on red colored area of the button.
How can I manage the Mouse clicks or Irregular Button shapes in Flex?
Thnx ... Atul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看这个:flexlib >图像映射。
摘自stackOverflow
Check this out: flexlib > ImageMap.
Taken from stackOverflow
使用基于矢量图形的按钮外观(例如,在 Illustrator 中制作的按钮外观),将每个状态保存为文档中的命名符号,然后导出为 SWF。参考皮肤如下:
Flash 会自动从可见部分确定点击区域。这个示例(不称为“myfile.swf”)现在正在应用程序中为我们工作。
Use button skins based on a vector graphic (e.g., one made in Illustrator), save each state as a named symbol in the document, then export as SWF. Reference the skins as follows:
Flash will automatically determine the hit area from the visible portion. This example (not called "myfile.swf") is working for us right now in an application.
创建 3 个也继承自 Canvas 的子类。例如左箭头按钮、中箭头按钮、右箭头按钮
公共类LeftArrowButton:Canvas {
受保护的覆盖函数 updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
您还可以创建通用类 ArrowButton 并从该类继承另外 3 个类并重写绘图函数
通过重写 createChildren():void 方法将此 3 个子按钮对象添加到 ArrowButtonsHolder
}
PS:我的代码中可能存在大量语法错误,但您应该大致了解如何做到这一点
Create 3 children classes also inherited from Canvas. For example LeftArrowButton, MiddleArrowButton, RightArrowButton
public class LeftArrowButton:Canvas {
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
You also can create general class ArrowButton and inherit another 3 from that class and override drawing function
Add this 3 child button object to ArrowButtonsHolder by overriding createChildren():void method
}
PS: There might be tons of syntax mistakes in my code but you should get general idea how to do it