473,815 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button Event Handling AS3.0

karlectomy
64 New Member
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::E ventDispatcher/addEventListene r()

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 2931

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

Similar topics

8
10820
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 ille quis mortem cum maximus ludos, vincat
5
73227
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
4036
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 ontop of the webform1: Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code "
3
2521
by: Wang | last post by:
Here is the code for a webcontrol, quite simple: ------------------------------------------------------------------------------------------------------------- <%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="WebApplication23.WebUserControl1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <STYLE> ..ModuleContent P { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }...
1
2523
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 raises a global flag and a repeater OnItemCreated event that modifies the repeater items accordingly. My problem is that the click event for the button is fired after the OnItemCreated event for the repeater when the flag still has a default...
3
2066
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 type="submit" ....' (a.k.a. submit button) and this can have a big impact on your web site's keyboard handling. Default IE behavior when you have the keyboard focus on an edit field is to find the first submit button and trigger a click event on it ...
3
2679
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 (below) would work. It doesn't. A break point on btn_Click isn't even hit. Is there a way to do this? Paul
12
7391
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 into a datagrid. When a user presses the enter key on this button I want the mouse click event to be activated but instead the tab page's validating event is called. I understand that this behaviour is by partly by design (Accept button etc) but I...
6
8786
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 launches. I've wired up my event handler to each Menu item and toolbar button. (I use the same Event handler and I use the Tag property which is different for every Menu Item and Toolbar buton to determine which menu or button is being clicked and to...
6
1231
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 System.Object, ByVal e As System.EventArgs) What harm or limitations would ensue if (ByVal sender As System.Object, ByVal e As System.EventArgs) were changed to (). Thanks, Dean S
0
10672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10427
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9225
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5710
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3886
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.