Graph Opinion

:blush: oops

Apparently, I needed a stop action in there. Cause I just added that to the cbtn0 and it worked. Wonder why I would only need to add it to that mc and not any of the others? Maybe I just need the stop on my main timeline, before I define the array…

Not really sure what you are doing, the action should be on the timeline containing the button mc`s and the mcs.

Not really sure what you are doing

That makes two of us :ne:

Thanks, I did move the stop action to the main timeline, so I used this code:

[COLOR=Navy][SIZE=1]stop();
myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
color0.col = 0x990000;
color1.col = 0x9966CC;
color2.col = 0xFFFF99;
color3.col = 0x9999FF;
color4.col = 0xFF9900;
for (var j = 0; j<5; j++) {
this[“color”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}[/SIZE][/COLOR]

And it works like a charm! Thanks for all your patience. I am sure I will be back with more questions.

you are welcome and I am blessed :pope:

:angel: Who’s the blessed one? :lol:

Shouldn’t this work to fade the alpha of “mystate” mc’s if I have it in the first frame of my movie?

for (var i = 0; i<48; i++) {
this[“myState”+i].ivar = i;
}
this[“myState”+i].onRollover = function() {
_alpha = 0;
};

Well crap that second curly bracket was in the wrong place- moved it like this:

for (var i = 0; i<48; i++) {
this[“mystate”+i].ivar = i;
this[“mystate”+i].onRollover = function() {
_alpha = 0;
};
}

now everything disappears when I rollover a mc…L

Use this._alpha=0

inside a callback function, “this” refers to the object calling the function.
eg/myButton.onPress = function() {
trace(this._name);
};
outputs myButton
But outside, “this” usually refers to the timeline.
eg/this[“mystate”+i]
your_alpha = 0 refers to the timeline on which this[“mystate”+i] are

Ah yes thank you!
I was trying many other things, but of course that was not one of them.

Alright here’s another shouldn’t this work -

The color changing that you helped with yesterday, if I wanted to allow the person to “reset” all the mc’s back to their orignal color it seems as though this should work:

I have a button instance named reset

I have this code on frame 2 of the maintime:

[COLOR=Navy][SIZE=1]myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
reset.onPress = function() {
myColour = new Color(myArray);
myColour.setRGB(0xEAEAEA);
};[/SIZE][/COLOR]

I have already tried adding [COLOR=Navy][SIZE=1]this.[/SIZE][/COLOR] and [COLOR=Navy][SIZE=1]_root.[/SIZE] [/COLOR] in front of [COLOR=Navy][SIZE=1]reset[/SIZE][/COLOR] and that did not work either

Also, it actually follows the code from yesterday (so it looks just like this)

[SIZE=1][COLOR=Navy]stop();
myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
color0.col = 0x990000;
color1.col = 0x9966CC;
color2.col = 0xFFFF99;
color3.col = 0x9999FF;
color4.col = 0xFF9900;
for (var j = 0; j<5; j++) {
this[“color”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}

myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
reset.onPress = function() {
myColour = new Color(myArray);
myColour.setRGB(0xEAEAEA);
};[/COLOR] [/SIZE]

so would I have to redefine the array like I am?

its not as easy as that;Try this to see if it works

stop();
myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
color0.col = 0x990000;
color1.col = 0x9966CC;
color2.col = 0xFFFF99;
color3.col = 0x9999FF;
color4.col = 0xFF9900;
for (var g = 0; g<myArray.length; g++) {
myArray[g][“myColour”+g] = new Color(myArray[g]);
myArray[g].col = myArray[g][“myColour”+g].getTransform();
}
for (var j = 0; j<5; j++) {
this[“color”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}
reset.onPress = function() {
for (k=0; k<myArray.length; k++) {
myArray[k][“myColour”+k].setTransform(myArray[k].col);
}
};

if it does, i`ll try explain,if not ,try something else

Well of course it works. (-: beautifully!
I am going to look up [SIZE=1][COLOR=Navy]getTransform();[/COLOR][/SIZE] and see if I can figure out what is going on with all this

Yeh, I had to look it up too.
Thought you may struggle a little with the loops
when g=0
myArray[g][“myColour”+g] = new Color(myArray[g]);
same as
myState27.myColour0 = new Color(myState27)
here we add a property to mystate27 called col
myArray[g].col = myArray[g][“myColour”+g].getTransform();

Well this is what I have spent a large part of my morning trying to figure out. I think one of the biggest blocks I have in being able to write these things myself is that some things do not seem to have one definate thing that they do.

You know what I mean? Like they have a specific job they do but the details of that job can be so different and the job can be done in so many places. Maybe I am getting too abstract trying to explain that L

Anyway, back to what I did this morning, went through the code and commented it trying to make myself understand why it is working, so here goes:

[COLOR=Navy]stop();
[COLOR=DarkRed]//myArray stores the mcs that will change color[/COLOR]
myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];

[COLOR=DarkRed]//these target the 5 buttons and sets the color object for each button
//which is used to store the color that will be applied to the mcs when the
//button is pressed, not the actual button color[/COLOR]
color0.col = 0x990000;
color1.col = 0x9966CC;
color2.col = 0xFFFF99;
color3.col = 0x9999FF;
color4.col = 0xFF9900;

[COLOR=DarkRed]//this is a loop that sets a variable equal to the length of (how many mcs are in)
//the array?[/COLOR]
for (var g = 0; g<myArray.length; g++) {

[COLOR=DarkRed]//takes the mc’s in the array which have been defined as the variable g
//and sets a new color object with the variable name “myColour”
//and we will leave it spelled in the British way in honor of Stringy =)
//this new color object is the original color of the mcs[/COLOR]

myArray[g][“myColour”+g] = new Color(myArray[g]);

[COLOR=DarkRed]//this defines the color property of g (all the mcs in the array)
//and stores the color in the myColour object using getTransform
//(getTransform is a new object which specifically stores that
//original color?, for this instance of the color object)[/COLOR]
myArray[g].col = myArray[g][“myColour”+g].getTransform();
}

[COLOR=DarkRed]//this is another loop which sets a varible j that applies 5 times
//meaning that it will execute this function for each of the 5 buttons[/COLOR]
for (var j = 0; j<5; j++) {

[COLOR=DarkRed]//it pulls the value of the color object set for the buttons
//and when the button is pressed executes the function
//the function uses another loop with a variable which again
//looks at the length of the array to allow it to apply the function
//to each mc in stored in the array
//a new color object is created for the array and the color of the mcs
//is changed with the setRGB to the color value stored in the button
//color object[/COLOR]
this[“color”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}

[COLOR=DarkRed]//when the reset button is pressed the function again uses a variable in a
//loop so that the result is applied at all mcs stored in the array
//it calls upon the color property and uses setTransform to retrive
//what was stored with getTransform in that color object[/COLOR]

reset.onPress = function() {
for (k=0; k<myArray.length; k++) {
myArray[k][“myColour”+k].setTransform(myArray[k].col);
}
};[/COLOR]

Please if you would, make any corrections or more comments.

//these target the 5 buttons and sets the color object for each button x
color0.col = 0x990000 // col is just a property

//takes the mc’s in the array which have been defined as the variable g
just looping through myArray[0],myArray[1],myArray[2]…
g just increases by 1 each time.

//and we will leave it spelled in the British way in honor of Stringy
you are learning! proper spelling is important.

myArray[g][“myColour”+g] = new Color(myArray[g]);
This makes a new color object for each movieclip and stores it as a property of the movieclip.so we have myArray[0].myColour0 etc I have made a mistake here as there was no need for number after the myColor.This is not the original colour of the mc.
but this is
myArray[g].col = myArray[g][“myColour”+g].getTransform();
}
Think the rest is more or less right. If you want to do away with the extra g,complete code is

stop();
myArray = [mystate27, mystate17, mystate30, mystate21, mystate6, mystate5, mystate45, mystate42, mystate29];
color0.col = 0x990000;
color1.col = 0x9966CC;
color2.col = 0xFFFF99;
color3.col = 0x9999FF;
color4.col = 0xFF9900;
for (var g = 0; g<myArray.length; g++) {
myArray[g][“myColour”] = new Color(myArray[g]);
myArray[g].col = myArray[g][“myColour”].getTransform();
}
for (var j = 0; j<5; j++) {
this[“color”+j].onPress = function() {
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
}
};
}
reset.onPress = function() {
for (k=0; k<myArray.length; k++) {
myArray[k][“myColour”].setTransform(myArray[k].col);
}
};

Finally I can get back to this.

Well the “mistake” you say you made earlier regarding the number after myColor, those are the kind of things that confuse me. (when it comes to trying to do scripting on my own) Because it did work that way, I guess you just mean it wasn’t the best way to do it.

Thank you for adding to the comments. I feel like I have learned so much through all your help. Anyway, back to work for now…

Stringy~ are you out there?

Do you suppose if I wanted to disable the movie clips that change color (once the user selects a certain color button) that those clips would be effected by the script used to load a question when a movie clip is selected?

You see, I put the script on the second frame of the movie that changes the color of certain clips once a color chooser button is selected. These clips are stored in myArray.

Now, on the first frame of the movie I have the script that fades the alpha of the movie clips onRollver and returns it normal onRollout. Also, the script that loads the questions once a clip is selected is on this frame.

Is it possible that the script that is saying load the question onPress would be overiding the script that would disable the clips that are set to a color?

Because the way the question loading script is set up, it includes all the movie clips it would even address the clips that were stored in the array (the array that is used for the completely seperate purpose of color changing)

I know you may not be following exactly what I am trying to do here and I cannot attach my fla it is far too large. Here is a link to the swf, but is messed up because I was working on the question part as well and I know an swf that is not even working correctly probably does not help much.

http://www.cbservices.org/cbs/test/jill/natri.html

These are the goals, in order:

1.User enters name
2.User name is returned, telling the user to choose a color
3.User chooses color and certain states turn that color
4.The states that have turned that color are set to enabled= false;
5.The user is then allowed to click on up to 10 other states
6.When a state is clicked on a question loads
7.If the user answers the question correctly that state will turn the same color as chosen by the user in step #3
8.If the user answers the question incorrectly that state will turn a color other than one chosen by the user in step #3

There are other steps beyond that but I feel like I need to get at least this much figured out for now. Also, chosing a correct or incorrect answer will trigger another action other than changing the color of a state. There will be some type of graph that shows the result of that question.

See the attachment also for the description I have from my boss as to what is supposed to be accomplished with all this. It keeps getting things added to it though.

wait…maybe I do have those colored movie clips disabled. Because I only put in enough content to test 10 questions and they would be in alphabetical order of the states because that is the way I have them labeled-

Example:

alabama = mystate0
arizona= mystate1
arkansas= mystate2

And Connecticut, which is mystate5 does not load a question when I choose it, though it still fades the alpha on Rollover

Blimey, i think i read War and Peace quicker.

You would probably be much better trying to do everything in one frame.
Is there anyway you can provide me a link to the fla and i`ll have a look.

Yes I think I am trying to do so many things and piece them together rather than in a rational step by step way.

I guess I didnt think ahead as to how much things would effect each other.
Another problem I have already thought of is the question is not always going to match up with the state.
The questions are supposed to be realted to each state not just random, and the way they are loaded just adds one the mystate# each time, which is not necessarily the number of that state. I am talking about the code below (in red)

questions = [“is this the first state chosen?”, “2.what shape is this?”, “3.what direction is this?”, “4.who lives here?”,“5.who lives here?”, “6.who lives here?”, “7.who lives here?”, “8.who lives here?”,“9.who lives here?”];
answers = [[“this is the first state”, “this is not the first state”, “this is not the first state”, “this is not the first state”], [“square”, “oval”, “triangular”, “who cares”], [“North”, “South”, “East”, “West”], [“The president”, “The presidents fancy piece”, “nobody”, “don`t know”]];
correctanswer = [“this is the first state”, “square”, “East”, “nobody”, “nobody”, “nobody”, “nobody”, “nobody”, “nobody”, “nobody”];
//number of states here
[COLOR=DarkRed]for (var i = 0; i<10; i++) {
this[“mystate”+i].ivar = i;
this[“mystate”+i].onPress = function() {
myclip = _root.attachMovie(“mystatequestion”, “question”, i+10);[/COLOR] myclip.myText.text = questions[this.ivar];
//the following lines are for the benefit of your components
//may be a better way
_root.k = this.ivar
comp0var = answers[this.ivar][0];
comp1var = answers[this.ivar][1];
comp2var = answers[this.ivar][2];
comp3var = answers[this.ivar][3];
comp4var = answers[this.ivar][4];
comp5var = answers[this.ivar][5];
comp6var = answers[this.ivar][6];
comp7var = answers[this.ivar][7];
comp8var = answers[this.ivar][8];
comp9var = answers[this.ivar][9];
question._x = 400;
question._y = 400;
this.enabled = false;
};
}

Well anyway, if I zip my fla it is 48 k. Let me try something and I will get right back with you.

okay try this:

http://www.cbservices.org/cbs/test/jill/whatamessIhavemadeofthis.zip

one more thing, the reason I have 2 frames has to do with entering and returning the name

Ill put it all on to one frame and go from there, i dont have too much time tonight but hopefully tomorrow all will be ok.