Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-06-2003, 01:36 AM   #1
sandman9
Senior Member
 
Join Date: Oct 2002
Location: Canada
Posts: 449
Default check box

How do you make a checkbox in flash?
sandman9 is offline   Reply With Quote
Old 05-06-2003, 06:41 AM   #2
overjoyed
soli Deo gloria
 
overjoyed's Avatar
 
Join Date: Jun 2002
Location: Geneseo, IL
Posts: 20
Default

There are a lot of ways check boxes can be created. The simplest being using the premade check box component in MX.

If you're dealing with a previous version of Flash such as 5, then my favorite way of creating a check box that is NOT checked by default and gives a boolean response is as follows:


1. Create two buttons, one for "checked" and one for "unchecked" as you would like your box to appear

2. Create a new MC called "checkBox" (or whatever name you like better) and put your buttons inside with the "checked" button on top of the "unchecked" button

3. Give these buttons instance names of "checked" and "unchecked" respectively

4. Edit the script for "checked" to be the following:

ActionScript Code:
on(release) {      this.checked._visible = false;      this.unchecked._visible = true;      _global.isChecked = false; }

and the script for "unchecked" to be the following:

ActionScript Code:
on(release) {      this.checked._visible = true;      this.unchecked._visible = false;      _global.isChecked = true; }

5. Place an instance of checkBox where ever you want your box to be and give it an instance name of "mycheckbox"

6. Edit the actionscript of "mycheckbox" to include the following:

ActionScript Code:
onClipEvent(load) {     this.mycheckbox.checked._visible = false;     this.mycheckbox.unchecked._visible = true;     _global.isChecked = false; }

This will give you a MC (2) with the name "mycheckbox" (5) that when it loads will set the global variable (_global.isChecked) to false and hide the "checked" button (6). You will then only see the "unchecked" button that when clicked will set the global variable to "true" and hide itself while showing the "checked" button(5b). Then if you click the "checked" button, the global variable will be set once again to "false" and the "checked" button will be hidden while the "unchecked" button will show(5a).


I hope this helps. If you still can't seem to get it to work for you, try searching around a little harder for an example .fla with a check box already in it.

Cheers, Overjoyed
overjoyed is offline   Reply With Quote
Old 05-06-2003, 08:09 AM   #3
sandman9
Senior Member
 
Join Date: Oct 2002
Location: Canada
Posts: 449
Default

How does the premade check box for MX work? Where do you go to find that option?

thanks
Sandman9
sandman9 is offline   Reply With Quote
Old 05-06-2003, 08:49 AM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Thank you for the thorough explanation, overjoyed... Much appreciated...

Hey, sandman9... Any reason why you are asking totally different question right after overjoyed answered your previous question??? Or, are you thinking that you were asking the same question??? Obviously your two sentences are totally different questions if you do not know... Well... I hope you are asking two questions that happen to be to with the same term 'check box'... Otherwise, I'd be real mad if I were overjoyed...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 05-06-2003, 02:50 PM   #5
overjoyed
soli Deo gloria
 
overjoyed's Avatar
 
Join Date: Jun 2002
Location: Geneseo, IL
Posts: 20
Default

Thanks for the reply, CB. Yes this would have been a better question for a new post, but the joy continues and I'm only too happy to help. Hence the name.

Components are new to Flash MX, so if you're using Flash 5, stick with the example I gave you. In Flash MX hit "Ctrl+F7"(win) or "Command+F7"(mac) to open the components box. With the default component set, the check box should be first in the list.

If you have any questions about components (epsecially this one) hit the handy-dandy little "F1" key on the upper left of your keyboard and use the docs Macromedia so kindly wrote for us.

Cheers, Overjoyed
overjoyed is offline   Reply With Quote
Old 05-06-2003, 05:08 PM   #6
sandman9
Senior Member
 
Join Date: Oct 2002
Location: Canada
Posts: 449
Default

sorry guys ..... didn't meant to ask two differ questions .... i've been rushed these past days .... but my question just got answered in that last post ..... thanks a billion man

Cheers
Sandman9
sandman9 is offline   Reply With Quote
Reply


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

Forum Jump


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