Reputation: 1117
This is my ActionScript:
var containers = [
option1Container,
option2Container,
option3Container,
option4Container
];
for (var i = 0; i < containers.length; i ++) {
containers[i].BlueBox.filters = [myShadowFilter];
//BlueBox is an object inside the container. The above line adds a DropShadow to BlueBox
containers[i].addEventListener(MouseEvent.MOUSE_OVER, optioniContainerOver);
//give each item in the array the same mouse over and mouse out listener
containers[i].addEventListener(MouseEvent.MOUSE_OUT, optioniContainerOut);
}
//create a color transform called optionOver
var optionOver:ColorTransform = new ColorTransform();
optionOver.color = 0xCC6600;
function optioniContainerOver(evt:Event):void {
containers[i].BlueBox.transform.colorTransform = optionOver; //this doesn't work.
}
Now, as you can see, what I'm trying to do with the function called optioniContainerOver is, that whenever a movieclip inside the containers array is hovered over, I want just that specific MovieClip to turn orange (0xCC6600). Is there a way for me to do this?
Upvotes: 0
Views: 187
Reputation: 3728
You'll want to take a look at the target
of the event:
function optioniContainerOver(evt:Event):void {
evt.target.BlueBox.transform.colorTransform = optionOver;
}
Depending on the composition of the displayObject
firing the event, you may need to use currentTarget
instead.
From the documentation:
The object that is actively processing the Event object with an event listener. For example, if a user clicks an OK button, the current target could be the node containing that button or one of its ancestors that has registered an event listener for that event.
Upvotes: 2