This content has been marked as final. Show 8 replies
Sorry i didnt mean to post this twice.
You name a checkbox the same way you name a text input field, in the Properties panel
You can use the 'selected' property to determine if the checkbox is selected or not (true or false), and use that to assign the values -1 and 0 to a variable.
Go thru the Checkbox class documentation and you'll find all the features it supports
I'm not talking about the instance name, I'm talking about the variable name. The thing is, when I go to "Properties" for my Input Text field, at the very bottom of the properties panel there is field for "Variable," where I give it a name. However, when I view the properties panel for my CheckBox component, there is no "Variable" field to enter a variable name for the CheckBox. I need to know how to give a variable name to the check box. I have no idea how?
That's because textfields can directly represent variables and can have a completely different instance name if one desires... you still have to declare a variable by that name in the actionscript though.
Checkboxes don't have variables names, that's why you don't see it being offered. As I already said, you can create your own variable and set the value based on the selection of the checkbox either when it's selected/deselected or when you want to process data for sending.
Can you show me what this might look like, in AS 2? Thanks so much!
Start a new Flash file and place a checkbox and a dynamic textfield on the stage.
Give the checkbox an instance name of cBox
Give the textfield a variable name of cBoxStatus and an instance name of cBS
Then plant the following code in the timeline, play the movie, click the checkbox a few times. You can read the textfield directly for the values you say you want (0,-1) via: cBoxStatus or Number(cBS.text);
If you don't want the textfield to be visible, there are a number of ways you can hide it. I'll let you work that out... something to think about and solve--don't think too hard though--it's not difficult.
Ned, this worked perfectly. I could kiss you!
Thanks so much!
Oh, to be single again!