|
-
Can't get value of checkbox component - why?
This is so simple yet it's making me crazy. I'm simply trying to get the value of a component checkbox with the instance name of "check1".
I have one line of actionscript that reads:
Code:
check1_value = check1.getValue();
Shouldn't this assign the true/false value to the "check1_value" variable? Why doesn't it work?
Last edited by Danger Madcow; 07-26-2004 at 06:43 PM.
-
Registered User
hi,
You don't mention the version you're using, but in MX 2004, you use the selected property:
code:
check1.selected
-
I am using MX 2004. Setting the code to:
Code:
check1_value = check1.selected;
does indeed return true or false, but only the initial true/false value. How would I set this up so that toggling the checkbox would auto-update the variable?
-
Registered User
Look in your reference!
code:
myListener = new Object();
myListener.click = function(eventObj)
{
trace("The selected property has changed to " + eventObj.target.selected);
};
check1.addEventListener("click", myListener);
-
I always forget to RTFM. Thanks for your help - it worked perfectly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|