• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Please Help, Event Listener Not Listening

New Here ,
Mar 24, 2011 Mar 24, 2011

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]);

}

TOPICS
ActionScript

Views

369

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 24, 2011 Mar 24, 2011

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.

Votes

Translate

Translate
Community Expert ,
Mar 24, 2011 Mar 24, 2011

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines