Skip to main content
Known Participant
November 12, 2007
Answered

How to make several Check boxes interact to load a movie

  • November 12, 2007
  • 27 replies
  • 1580 views
Hello,
I have a very complicated doubt. I have a document called “selection” with 15 check boxes.

The check boxes are divided into groups. The first group is “category” and has 4 check boxes named “eco”, “conf”, “spor” and “ultr”, the second group is “makers” and has 4 check boxes named “bridge”, “dun”, “cont” and “fire”, the third group is “velocity code” and has 4 check boxes named “j”, “k”, “l” and “m”, finally the fourth group is “Run Flat” and has 3 check boxes named “yes”, “no” and “just” and I have a submit button.
I have also a “main” document that has 20 holders called “holder1”, “holder2”, and so on…

I would like to know if there is a way of, when I click the submit button if, for example, the check boxes “eco” and “conf” of the first group, the check boxes “bridge” and “fire” of the second group, the check boxes “j” and “m” of the third group and the check box “just” of the fourth group are selected, then, the movie “eco_bridge_j_just.swf” is loaded to holder1, the movie “eco_bridge_m_just.swf” is loaded to holder2, the movie “eco_fire_j_just.swf” is loaded to holder3, the movie “conf_fire_m_just.swf” is loaded to holder4 and so on…

Please tell me that it is possible and the best way of doing it. My Action Script is not very good so I thank everyone who can help me.
This topic has been closed for replies.
Correct answer kglad
you have to understand those 4 for-loops if you want your swfs to load into particular alvo movieclips. if you don't care where your swfs load you can probably use:

27 replies

kglad
Community Expert
Community Expert
November 15, 2007
you don't need to panic. but i don't know what you're doing.

use the trace() function to pinpoint problems. if something is undefined, that's a problem. fix it.

if something is defined but the trace output isn't what you expect, fix it.

you do need to get organized and methodically debug your project. when you pinpoint a problem and don't know how to resolve it, that's when posting to this forum is most likely to be helpful.
kebatAuthor
Known Participant
November 15, 2007
I thought everything was working perfectly. I thought the output panel didn't show the trace because the trace was to a target in another document. I forgot to tell you that, when I test my "main" document, in the output panel 2 traces appear (trace alvo1 and trace alvo1), even though I only have one trace in that document.
If I select a label in the combo box and the swf's that are supposed to be loaded are not in that folder the output panel shows: undefined : 205-55 16.swf undefined : 225-50 16.swf undefined : 115-85 18.swf.
Isn't it right? Is dis going to work? Can I do something to make the swf's that are supposed to be loaded from the selection of the check boxes to be loaded into my targets in this document? Should I panic now?
kglad
Community Expert
Community Expert
November 15, 2007
if you don't see anything from a trace() function, it means that portion of your code didn't execute. ie, your for-loop didn't execute and your loadMovie() methods didn't execute.
kebatAuthor
Known Participant
November 15, 2007
That code was a little bit different because it belonged to a combo box (in _level3) that was meant to load the swf's in the targets located in _level0.
When I test this movie (the combo box in _level3), the output panel don't show any trace. In the "main" document (my _level0) I also have a - trace(alvo1); - and when I test my movie in the output panel 2 traces appear.
I now have a lot of targets in the same document of the check boxes. The targets exist and are named "alvo1", "alvo2" and so on.

I'm not sure if I'm explaining myself properly. My English is almost as bad as my action script. I'm sorry for that!
kglad
Community Expert
Community Expert
November 15, 2007
use the attach code option to display code in this forum.

does that trace reveal the external files you want to load and show those target movieclips exist?
kebatAuthor
Known Participant
November 15, 2007
Thank you for all your help.
Can you just tell me how can I load the swf's to targets "alvo1", "alvo2", etc ?
I'm trying to combine (in every way possible) the combo box script with this one but I can't get it right.
The combo box script that I have is this:

for (var i = 0; i<e.target.selectedItem.data.length; i++) {
_level0["alvo"+(i+1)].loadMovie(e.target.selectedItem.data );
trace(_level0["alvo"+(i+1)]+" : "+e.target.selectedItem.data
);

But once I change the:
tl["mc_"+i1+"_"+i2+"_"+i3+"_"+i4].loadMovie(gp1A[i1]._name+"_"+gp2A[i2]._name+"_"+gp3A[i3]._name+"_"+gp4A[i4]._name+".swf");

the script no longer works. Thank you for everything!
kglad
Community Expert
Community Expert
November 15, 2007
radiobuttons should work, too.

the main document is _level0. anything you load into _level0 becomes the main document and anything that existed prior to loading into _level0, is unloaded.

check the help files: as2 component language/checkbox for all its methods and properties. you'll see you can detect if they are selected and, if not, you can for a string of their names or data to suit your needs.
kglad
Community Expert
Community Expert
November 15, 2007
radiobuttons should work, too.

the main document is _level0. anything you load into _level0 becomes the main document and anything that existed prior to loading into _level0, is unloaded.

check the help files: as2 component language/checkbox for all its methods and properties. you'll see you can detect if they are selected and not you can for a string of their names or data to suit your needs.
kebatAuthor
Known Participant
November 15, 2007
Thank you so much! It's already loading the swf's.
You didn't tell me if the code will remain the same if I use radio buttons instead of check boxes in the fourth group.

And is there a way of loading the "main" document in level0 and the load the swf's to the targets in the "main" document, instead of loading them to an empty movie clip? The problem of load the swf's to an empty movie clip is that the swf's are loaded on top of the things that are already in that page (in top of the check boxes) and if more than one swf is loaded, they are loaded one in top of the other.
Another thing that I wanted to ask you is if there is a way of changing the script to assume that all the check boxes of one group are selected if the user selects none. I need it because the the swf's are loaded only if, at least, one of the check boxes of each group is selected.

Thank you!
kglad
Community Expert
Community Expert
November 13, 2007
there should be 3 } at the end of that code instead of two.

copy and paste your code using the attach code option.
kebatAuthor
Known Participant
November 15, 2007
The last time I've tried to simplify my doubts I ended up confusing you. I'm so sorry for that. As you will see, what I'm trying to do is a little bit more complicated.

I want to change the fourth group. I want to use radio buttons instead of check boxes but just for the fourth group. Does the code remains the same?
I also wanted that, when I press the submit button, the movie "main" was loaded to level 0 (because it's in the main document that I have my targets) and the swf's were loaded to the targets in the main document. Is it possible?

Thank you for all the help you are giving me!
This is my code
kglad
Community Expert
Community Expert
November 15, 2007
: