Copy link to clipboard
Copied
Hey, I am stuck trying to use some code I have used in the past to pass args through an event listener. I must find a way to do this
This is what I am doing, using an inline function. I dont completely understand how it all works, but know that in one open FLA it works and in the other it does not. The error thrown is #1178: Attempted access of inaccessible property spotlightBox through a reference with static type..." SpotlightBox is the name of the function I'm trying to pass data to.
The main difference in the two FLA's is that, in the broken one, it's constructed inside a for loop. But not sure how that is a problem. If you have some guidance I would greatly appreciate it. My work deadline is in tomorrow and I am stuck.
This is being used inside a with block for each sprite:
addEventListener(MouseEvent.ROLL_OVER, function onRoll_Over(e:Event) { spotlightBox(e, new Array("5"))});
And here is the function:
function spotlightBox(e:Event, arg:Array):void
{
trace(arg[0]);}
use:
addEventListener(MouseEvent.ROLL_OVER, function(e:Event) { spotlightBox(e, new Array("5"))});
function spotlightBox(e:Event, arg:Array):void
{
trace(arg[0]);}
but your main problem is using a with() statement to add listeners. that's probably not going to work.
Copy link to clipboard
Copied
use:
addEventListener(MouseEvent.ROLL_OVER, function(e:Event) { spotlightBox(e, new Array("5"))});
function spotlightBox(e:Event, arg:Array):void
{
trace(arg[0]);}
but your main problem is using a with() statement to add listeners. that's probably not going to work.