# Component help w/boolean value

**URL:** <https://forum.kirupa.com/t/component-help-w-boolean-value/26284>\
**Category:** Uncategorized\
**Created:** [July 21, 2003, 6:16pm UTC](https://forum.kirupa.com/t/component-help-w-boolean-value/26284 "2003-07-21T18:16:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)\
**Post date:** [July 21, 2003, 6:16pm UTC](https://forum.kirupa.com/t/component-help-w-boolean-value/26284/1 "2003-07-21T18:16:36Z")

</div>

I am trying to develop a multiple choice quiz using learning interactions (components)  
It will be a series of 4 checkboxes, and if the checkbox chosen is wrong a certain mc will play, and if it is right a different mc will play.  
So far, I have 2 tests going and I realize that I need to set  
a boolean value to true in order for this to work the way I want.

When I have this code the mc plays as soon as the movie starts:  
\<hr\>  
function onChange(component)  
{  
if (component.\_name == “Checkbox1”)  
\_root.attachMovie(“wrong1”,“wrong2”,200);  
}  
\<hr\>

Well, I realized I had not told it to play only if the instance “Checkbox1” is true, so I tried this:  
\<hr\>  
function onChange(component)  
{  
if (component.\_name == “Checkbox1” && “Checkbox1” == true)  
\_root.attachMovie(“wrong1”,“wrong2”,200);  
}  
\<hr\>  
When I preview the movie and select “Checkbox1” , nothing happens.  
I wonder do I need to use an else if statement rather than trying to put it in the same section as the name equals, or what?

I am not sure what I am doing wrong.

Also, when the mc was playing (in the first example) it was cut off, only half the clip was showing. Any ideas about this as well?

:nerd:
