Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-04-2008, 01:52 AM   #1
Registered User
Join Date: Dec 2008
Posts: 8
Default referencing button label in click function

So I have a button in a Flex 3 project, that calls an AS function of mine when clicked. I want to pass the button's label as the parameter name to the function, but it doesn't seem to be working. Here is the example:

<mx:Button label="blahblah" click="myFunction(this.label);"/>

Can "this" not be used in the way that I am using it? Any other thoughts or ideas on how to accomplish this?


skippylou is offline   Reply With Quote
Old 12-04-2008, 10:38 AM   #2
Senior Member
Join Date: May 2008
Posts: 112

i think you can access the buttons label by casting the
event target property to Button. then you should be able to access
your buttonlabel inside the callback.

private function myCallback(e:MouseEvent):void {

  var button:Button = Button(e.target);

  if (button) {


something like that.
pulse00 is offline   Reply With Quote
Old 12-04-2008, 06:44 PM   #3
Registered User
Join Date: Dec 2008
Posts: 8

That worked fantastic! Thanks!

skippylou is offline   Reply With Quote

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Actionscript 2.0 Loop citizener ActionScript 2.0 8 08-04-2008 02:44 AM
[AS3] 3D game using flash cs3 and actionscript 3 manoskouf Gaming and Game Development 19 04-10-2008 04:41 PM
using a class to control things henleyb ActionScript 3.0 7 04-07-2008 01:32 AM
mx.utils.Delegate demystified astgtciv ActionScript 2.0 26 06-15-2006 03:12 PM
Audio Sound Question Chronix2005 ActionScript 2.0 0 07-27-2005 04:18 PM

All times are GMT. The time now is 03:21 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.