dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: check box component

  1. #1
    Member
    Join Date
    Jan 2002
    Posts
    82

    check box component

    I would like this code to be carried out when a person clicks on a checkbox

    _root.info[1] = "DJ SHelter http://www.vulvair.co.uk/ryo \n";

    and when a person reclicks (ie unchecks it)

    _root.info[1] = "";

    Thanks

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Planet Earth
    Posts
    298
    Define you Click handler, and in that function use an if statement that checked the value of the check box.
    Code:
    function isChecked (){
    	if (_root.mybox.getValue() == true) {
    		trace("yup");
    	}else {
    		trace("nope");
    	}
    }
    you'd put whatever you want to have happen if it is true in the if state brackets and then whatever happens when it is not checked in the else brackets.


    Hope that helps.
    ---
    Thinking outside of the box will get you fired if the "box" is strict budget.

  3. #3
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    To do this, you will need to create a change handler for your checkbox. First you need to create a function. I usually put functions on the first frame of the timeline where my component is. Here is the code that you will need for your function.
    Code:
    function checkBoxChange()
    {
    isChecked = myCheckBox.getValue();
    if(isChecked == 1 || isChecked == TRUE)
    {
    _root.info[1] = "DJ SHelter http://www.vulvair.co.uk/ryo \n";
    }
    else
    {
    _root.info[1] = "";
    }
    You will then need to give your check box an instance name of "myCheckBox" or change "myCheckBox" in the code to what ever you name it. Lastly you need to set your change handler on your Check Box to checkBoxChange. Hope this helps! Any question's, e-mail me at jason.wright@waterford.org.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  4. #4
    Member
    Join Date
    Jan 2002
    Posts
    82
    Thank you both very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center