473,378 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Button Event Handling AS3.0

karlectomy
Hi, I just recently started working with Flash CS3 and decided to try my fate in AS3. I did my research and read my sources and still I am having a problem with event handling on a button.
I want to have dynamic hover text on a series of buttons. Below I have implemented one of the buttons and I get this error at runtime:
TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()

I understand the error, it thinks that onHoverEnter() is null but I have debugged and it seems not to be null to begin with. Please help.

Thanks,

Karl

Expand|Select|Wrap|Line Numbers
  1.  
  2. lwrist.addEventListener(MouseEvent.MOUSE_OVER, captionFN(true, lwsttext, lwrist));
  3. lwrist.addEventListener(MouseEvent.MOUSE_OUT, captionFN(false, null, null));
  4.  
  5. var xo:int;
  6. var yo:int;
  7.  
  8. function captionFN(showCaption:Boolean, captionText:String, bName:SimpleButton) {
  9.  
  10.     if (showCaption) {
  11.         var hoverCaption:MovieClip = new MovieClip();
  12.         MovieClip(root).addChild(hoverCaption);
  13.         desc.capdesc.text = captionText;
  14.         desc.width = 7*desc.capdesc.text.length;
  15.         desc.alpha = 75;
  16.         //
  17.         if ((bName.width+bName.x+desc.width)>stage.width) {
  18.  
  19.             xo = -2-desc.width;
  20.             yo = -17;
  21.  
  22.         } else {
  23.             xo = 2;
  24.             yo = -17;
  25.         }
  26.         hoverCaption.addEventListener("enterFrame", onHoverEnter);
  27.         var onHoverEnter = function(ev:Event):void {
  28.             desc.x = root.mouseX+xo;
  29.             desc.y = root.mouseY+yo;
  30.             desc.visible = true;
  31.         }
  32.     } else {
  33.         hoverCaption.removeEventListener("enterFrame", onHoverEnter);
  34.         desc.visible = false;
  35.     }
  36.  
  37. }
  38.  
Mar 11 '08 #1
0 2904

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Nige | last post by:
Is it possible to create an alert box when a radio button is selected? I have a group of three, and I want a different alert for each one. -- Nige Please replace YYYY with the current year...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
3
by: Wang | last post by:
Here is the code for a webcontrol, quite simple: ------------------------------------------------------------------------------------------------------------- <%@ Control Language="c#"...
1
by: Mauritsius | last post by:
I have a simple page where I would like to modify a repeater (bounded to a dataset) if a button (outside the repeater) is clicked or not. I tried to solve this with a button click event that...
3
by: JV | last post by:
This is for anyone who has tackled the accessibility issue on their web site (and if you haven't, I bet you will in future). Apparently the asp:button control always renders as '<input...
3
by: PJ6 | last post by:
I've added a button to a class inheriting from System.Web.UI.Control and want to handle (pass on) its click event to the page that contains it. Coming from a WinForms background, I thought this...
12
by: SJ | last post by:
Hope someone can help me out there I'm struggling with a particular problem... I have a form with many tab pages. On one tab page I've got a button which when clicked with a mouse adds items...
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
6
by: Dean Slindee | last post by:
When you drop a button on a form, a Click event is created by the designer. Within the Click event certain event parameters are defined: Private Sub btnInsert_ButtonPressed(ByVal sender As...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.