Okay I tried it again and yes there is script in both mainstate and mainstate1.
I am feeling a bit intimidated by everything you have in here…unsure if I can even understand it all enough to customize things. I’m not giving up though…I did try and take some of your “keeping everything together” advice yesterday and rather than load the questions as swf’s, make them mc’s within the main movie and use the attachMovie command instead. I just don’t know how to adapt the code to allow for the variables in that case. I did address it in this thread:http://www.kirupaforum.com/forums/showthread.php?t=65490 but maybe I can figure that out once I take some more time with it. And maybe I won’t need to, if I can make sense of out the example you created. So, wish me luck!
i may be able to structure the code a little better for you and add comments, it was sort of flung together in a hurry.The attachmovie code would be much simpler and easy to use but it will add loads to your file size if you are attaching pictures of each state etc.
And i wish you good luck.
I don’t think it has anything to do with your code being poorly structured, it has to do with my limited understanding. :sen:
Perhaps I forgot to tell you that I will no longer be using any pictures or anything other than text in the questions which is why I thought it best to use them as mc’s rather than swf’s to keep things together more.
Here is the way I was going with it, I attached one of my test files. I tried adding in a [COLOR=Navy][SIZE=1]_root.total = 0[/SIZE][/COLOR], in the functions on the wrong answers (radio buttons) but that sets the number of right answers back to zero if they choose a wrong answer after the first question.
Also, ignore the please enter name thing, I was just testing that for later purposes.
edit: I figured out the setting correct answers to zero to start off…
it’s just a _root.total = 0 in the code on the first frame of the movie…
sometimes I make things much harder than they actually are
http://www.gifsrus.com/testfile/state_experiment5a.fla
i just kept the same arrays as before which had 4 elements so your button 5 does not work.
The way you were going it looked like you were going to have to make 52 seperate mcs. I`ve made the textfield dynamic in the movie you attach so hopefully you will just be able to use one.Theres still quite a bit to do in terms of scripting eg/ all the state movies really need to be disabled when there is a question and then enabled again later.
Yes with my way there would have to be (the number of selectable states has been decided to be 30) 30 movie clips that I would have to create. I will take a look at your new example and see what I can get out of it.
:beam: Yay! Your example seems to be the best way to work the questions, by far and I think I understand what is going on so I can put in the information needed. Now I just have to wait to get approval of the “look” of the whole thing so I can start my actual working quiz rather than just all the testing. I am excited to start putting everything together…does that make me a geek? L Oh well, so be it.
Why would the state mc’s need to be disabled if there is a question? Because the question will be over the states anyway so the user would not be able to access them at that moment anyway right?
I think you will find that it is still possible to click on the states. In the swf version, i think i disabled them but just left the code to a minimum in this.
Glad that you are exited about your project -Geek!!
:geek:
Well this entire time I never did notice that the states were still selectable behind the question mc. So, I know the [COLOR=Navy][SIZE=1]this.enabled = false;[/SIZE][/COLOR]disables the states once they have been clicked on, but why does that work? I guess because it is only executing all the the things once the state is clicked so it is at that point which it is disabled. Hmm. So now they all need to be disabled when one is clicked on, but enabled once they question has been answered, except for the ones that have already had questions answered. Sounds complicated. Guess I have something to think about on my drive home tonight…
added later:
okay so it is going to have to use an array too, right? To store the names of all the state mc’s and then when one is clicked target the array and set the enable to false on all of them…but then to go back to having the correct states enabled once you answered the question, you would have to target the array again but have an if statement that says if they have already have enable set to false, leave them false??
I think you have more or less got it but there are several ways to do it.
When one is pressed you could set up a loop to disable all of them and push the one which was clicked into an array.When a question is answered, enable all by means of a loop followed by disable the ones in the array.(wiil be in a fraction of a second so you wouldn`t tell.)
Well I am back to revive this thread with my pesky questions :hugegrin:
Regarding this same project that has been addressed in this entire thread…prior to the person choosing states and answering questions, I have instructions to set it up so that the person can choose a color for thier states to be.
I have it set up right now so that they enter their name and then it returns, Hello, Name, please choose your color, (etc)
I am going to have the color choices available as buttons and it will then turn certain mc’s that color and I need to store the color to use later on to use when the person answers a question correctly about a state they have chosen it will turn “thier color”
Now, I did find a tutorial that addresses the color issue, so I have that much.
[COLOR=Navy][SIZE=1]on (release) {
var colorful = new Color("_root.mcs");
colorful.setRGB(0x003366);
}[/SIZE][/COLOR]
I also know that I am going to need to use an array to hold the states (which are mc’s) because it makes things easier and thanks to Stringy I do have the code using arrays to deal with other things I want this “quiz” to do. I just am not sure how to apply that same idea to this.
I also know that I can address the changing color effect later on in the results of what happens once the person answers a question (though I am not exactly sure right now where that data will be, but from my understanding it will be stored as a variable and may have to be a global variable in order to be addressed from different functions) but I will tackle that when I get to it.
For now, how do I address the mc’s that I want to change as soon as the person clicks on the button of what color they want?
I hope this is not too much info…and thanks for any input!
:h: Do you address an array as if it were a mc? I think the answer is yes but I am not sure.
If I have to work hard enough I will eventually answer my own question and then I learn the best…
So I think I have to define my array and then put the code on the buttons:
[COLOR=Navy][SIZE=1]on (release) {
var colorful = new Color("_root.mcs");
colorful.setRGB(0x003366);
}[/SIZE][/COLOR]
and replace the mcs with the name of the array??
4 buttons instance names cbtn0,cbtn1…
mc`s mc0,mc1,mc2…upto mcNum
mcNum = 10;
//give each a property col
cbtn0.col = 0x003366;
cbtn1.col = 0xE34E1c;
cbtn2.col = 0x3229D6;
cbtn3.col = 0xF3F20C;
for (var j = 0; j<4; j++) {
this[“cbtn”+j].onPress = function() {
for (var i = 0; i<mcNum; i++) {
//if not on _root and using movieclip btns use this._parent instead of _root
myColour = new Color(_root[“mc”+i]);
myColour.setRGB(this.col);
}
};
}
Alternatively, if you put all the mc`s you want to change the colour of into one mc , bigmc
cbtn0.col = 0x003366;
cbtn1.col = 0xE34E1c;
cbtn2.col = 0x3229D6;
cbtn3.col = 0xF3F20C;
for (var j = 0; j<4; j++) {
this[“cbtn”+j].onPress = function() {
myColour = new Color(_root[“bigmc”]);
myColour.setRGB(this.col);
};
}
Stringy did I ever tell you that you are my Flash Hero? :crying:
Okay, question did you see the post I made at the same time you were replying to my first post today? And is that true? (about addressing an array the same as an mc)
Now, about the example code you have provided- does the mcNum=10 mean that this only goes up to 10, therefore meaning that the 10 that I would like to change the color of here would have to be my mc0 through mc10?
ps I like your new footer :crazy:
If you wanted to use an array, you would have to address each element of the array
eg/
//mc`s in array do not have to be numerical as i have done them but just useful for other stuff.
myArray = [mc0, mc1, mc2, mc3];
cbtn0.col = 0x003366;
cbtn1.col = 0xE34E1c;
cbtn2.col = 0x3229D6;
cbtn3.col = 0xF3F20C;
for (var j = 0; j<4; j++) {
this[“cbtn”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}
To use the code i typed before, you would have to label movieclips numerically up to mcNum which is anything you want. You don`t have to call them mc0,mc1,mc2… but could call them anythingyouwant0,anythingyouwant1,anythingyouwant2 and substitute the mc in the code with that.
Thanks,glad you like.
I think I understand. This code is so that you don’t have to put code on each individual button. I should know by now that you would be providing the most efficient way.
Yeh, us heros like to be efficient :lol:
The code is on the timeline
:lol:
I am having trouble with this part:
[COLOR=Navy][SIZE=1]cbtn0.col = 0x003366;
cbtn1.col = 0xE34E1c;
cbtn2.col = 0x3229D6;
cbtn3.col = 0xF3F20C;[/SIZE][/COLOR]
cbtn1 is the name of the button
.col is supposed to set the color that that hexidecimal?
.col is just storing a reference to the colour.Are you trying with an array or just by looping?