我想实现一种非常简单的方法来存储包含我单击的最后一个特定“CustomObject”的变量。我想点击其他对象被忽略。以下面的示例代码为例,假设 CustomObject 扩展了 MovieClip:
//Code within the Document Class:
var square1:CustomObject = new CustomObject();
var square2:CustomObject = new CustomObject();
var square3:CustomObject = new CustomObject();
var triangle1:DifferentObject= new DifferentObject();
square1.x=100; square2.x=200; square3.x=300;
addChild(square1);
addChild(square2);
addChild(square3);
addChild(triangle1);
//Code within the CustomObject Class:
this.addEventListener(MouseEvent.CLICK,radioButtonGlow);
public function radioButtonGlow(e:MouseEvent):void
{
var myGlow:GlowFilter = new GlowFilter();
myGlow.color = 0xFF0000;
myGlow.blurX = 25;
myGlow.blurY = 25;
this.filters = [myGlow];
}
每当我单击正方形时,这都非常有用-它们完全按预期亮起。但是,我想实现一个功能:1)将我单击的最后一个方块存储到文档类中的一个变量中 2)当我单击另一个方块时,从所有其他方块中移除发光
非常感谢任何反馈!