Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > Simple Stuff (Newbies)

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-18-2012, 04:07 PM   #1
weska
Registered User
 
Join Date: Nov 2010
Posts: 10
Default Property addEventListener not found on flash.geom.Rectangle and there is no default v

Hey so I'm having trouble with this :

ActionScript Code:
var rect = new Rectangle(b2.grid.x,b2.grid.y,b2.grid.width,b2.grid.height); rect.addEventListener(MouseEvent.CLICK,test);

I have a new Object "b2". It comes from my class DrawGrid.as,
which generates a bmp, and a lot more bmps copyPixeled to it.

I'm trying to make that bmp clickable, so I made a rectangle to click on,
but its returning this error

1069
Property addEventListener not found on flash.geom.Rectangle and there is no default value.

So I was wondering why I can't add evenlistener to my rectangle or if I'm just doing something wrong.

Thanks a million.
weska is offline   Reply With Quote
Old 05-18-2012, 04:41 PM   #2
weska
Registered User
 
Join Date: Nov 2010
Posts: 10
Default

So event listeners can only be added to display objects? Something that has been addChild'd? I made a new sprite, and added my object to the sprite, then addChild(sprite), add event listener and it works .
weska is offline   Reply With Quote
Old 05-18-2012, 07:03 PM   #3
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

addEventListener can only be used with EventDispatcher instances.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:10 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.