FORUMS: list search recent posts

** 1119: Access of possibly undefined property ***

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Aisha Nelson
** 1119: Access of possibly undefined property ***
on Jan 21, 2010 at 8:04:06 pm

I am creating a scrolling thumbnail panel in as3. when i try to test the panel i get this message:

1119: Access of possibly undefined property ENTER_FRAME through a reference with static type flash.events:MouseEvent......

This is the code that I have so far.
panel.addEventListener(MouseEvent.ROLL_OVER,panelOver);

function panelOver()
{
this.addEventListener(Event.ENTER_FRAME, scrollPanel);
delete this.addEventListener(MouseEvent.ROLL_OVER,panelOver);
}

var b = stroke.getBounds(root);

function scrollPanel(Event:MouseEvent):void
{
if(mouseX<b.xMin || mouseX>b.xMax || mouseY<b.yMin || mouseY>b.yMax)
{
this.addEventListener(MouseEvent.ROLL_OVER,panelOver);
delete this.addEventListener(Event.ENTER_FRAME, scrollPanel);
}

var xdist = mouseX - stage.width / 2;


panel.x += -xdist / 7;

}


Return to posts index

Pieter Helsen
Re: ** 1119: Access of possibly undefined property ***
on Jan 22, 2010 at 1:31:26 am

In which part of the code is the error occurring? can you post the entire error message?

Also, why do you use delete this.addEventListener() rather than this.removeEventListener?

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index

Marcus Geduld
Re: ** 1119: Access of possibly undefined property ***
on Jan 22, 2010 at 8:36:48 pm

Here's the problem:

function panelOver()
{
this.addEventListener(Event.ENTER_FRAME, scrollPanel);
delete this.addEventListener(MouseEvent.ROLL_OVER,panelOver);
}

var b = stroke.getBounds(root);

function scrollPanel(Event:MouseEvent):void
{
if(mouseXb.xMax || mouseYb.yMax)
{
this.addEventListener(MouseEvent.ROLL_OVER,panelOver);
delete this.addEventListener(Event.ENTER_FRAME, scrollPanel);
}

In this statement...

this.addEventListener(Event.ENTER_FRAME, scrollPanel);

... you are saying, when an EVENT happens, call the scrollPanel fucntion.

But in THIS statement...

function scrollPanel(Event:MouseEvent):void

... you're defining the scrollPanel function as receiving a MOUSEEVENT object, which is NOT the same thing as an EVENT object.

You need to change that to...


function scrollPanel(Event:Event):void

One last change I'd make if I were you:


function scrollPanel(event:Event):void

Above, you refer to the Event class, which should be capitalized (because its name is capitalized). But in your function header, you're referring to a VARIABLE which could have any name:

function scrollPanel(e:Event):void

function scrollPanel(evt:Event):void

function scrollPanel(event:Event):void

function scrollPanel(aFrogNamedTitus:Event):void

The variable will HOLD an Event object, but it isn't one. So it shouldn't have the name of one.


Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index


Aisha Nelson
Re: ** 1119: Access of possibly undefined property ***
on Jan 22, 2010 at 9:54:40 pm

Now I am getting this error in the output panel
"ArgumentError: Error #1063: Argument count mismatch on update.fla:MainTimeline/panelOver(). Expected 0, got 1."

This is the code i have updated with your previous posts.
panel.addEventListener(MouseEvent.ROLL_OVER,panelOver);

function panelOver()
{
this.addEventListener(Event.ENTER_FRAME, scrollPanel);
this.removeEventListener(MouseEvent.ROLL_OVER,panelOver);
}

var b = stroke.getBounds(root);

function scrollPanel(event:Event):void
{
if(mouseX<b.xMin || mouseX>b.xMax || mouseY<b.yMin || mouseY>b.yMax)
{
this.addEventListener(MouseEvent.ROLL_OVER,panelOver);
this.removeEventListener(Event.ENTER_FRAME, scrollPanel);
}

if(panel.x>= 94) {
panel.x = 94
}

if(panel.x<= -674) {
panel.x = -674
}

var xdist = mouseX - stage.width / 2;


panel.x += -xdist / 7;

}










Return to posts index

Marcus Geduld
Re: ** 1119: Access of possibly undefined property ***
on Jan 22, 2010 at 10:05:44 pm

panel.addEventListener(MouseEvent.ROLL_OVER,panelOver);

function panelOver( event : MouseEvent )
{
this.addEventListener(Event.ENTER_FRAME, scrollPanel);
this.removeEventListener(MouseEvent.ROLL_OVER,panelOver);
}

This line...

panel.addEventListener(MouseEvent.ROLL_OVER,panelOver);

... claims that you want Flash to call the panelOver() function. When Flash does that, it will send the function a MouseEvent object. You need a variable to receive that object, hence:


function panelOver( event : MouseEvent )

Which should actually be...


function panelOver( event : MouseEvent ) : void

... though you can get away with leaving void off.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index

Aisha Nelson
Re: ** 1119: Access of possibly undefined property ***
on Jan 22, 2010 at 10:24:58 pm

Thank you so much, it worked out Great!!!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]