边框容器创建通用的 mouseOver 函数
我尝试创建一个函数来更改边框容器的边框属性。 为此,我为 MXML 上的每个边框容器创建一个函数。
但我会更好地编码并执行通用功能。
今天我的功能是:
protected function bcContact_mouseOverHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
bcContact.setStyle("borderVisible",true);
bcContact.setStyle("borderWeight",2);
bcContact.setStyle("borderColor",'#000099');
}
bcContact是一个边界容器Id。
我尝试用它替换 bcContact 但它不起作用。
你能帮我解决这个初学者的错误吗?
谢谢
I try to create a function to change border property of border container.
To do that I create a function for each border container on my MXML.
But I'd to code better and to do a generic function.
Today my function is:
protected function bcContact_mouseOverHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
bcContact.setStyle("borderVisible",true);
bcContact.setStyle("borderWeight",2);
bcContact.setStyle("borderColor",'#000099');
}
bcContact is one border container Id.
I try to replace bcContact by this but it doesn't work.
Can you help me to solve this beginner mistake.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以使用
event.CurrentTraget
,然后使用比较函数,与ids进行比较并进行设置。U can use
event.CurrentTraget
and then use the compare functions, compare with ids and do the settings.您可以扩展 BorderContainer 类(在 Flash Builder 中,将 BorderContainer 放入“超级类”文本字段中)
您的类将如下所示:
该类需要位于文件
src/com/extensions/containers 中/MyBorderContainer.as
然后在您的 mxml 中使用它,
将命名空间
containers
设置为指向com/extensions/containers
You could extend the BorderContainer class (in Flash Builder, put in BorderContainer in the "Super class" text field)
Your class will look something like this:
This class will need to be in the file
src/com/extensions/containers/MyBorderContainer.as
Then use this in your mxml as
where the namespace
containers
is set to point tocom/extensions/containers