Graph Opinion

try/
function customCursorF() {
myArrow._x = _xmouse;
myArrow._y = _ymouse;
updateAfterEvent();
}
for (var z = 0; z<myArray.length; z++) {
myArray[z].onRollOver = function() {
Mouse.hide();
myArrow._visible = true;
cursInterval = setInterval(customCursorF, 10);
};
myArray[z].onRollOut = function() {
Mouse.show();
myArrow._visible = false;
clearInterval(cursInterval);
};
}

Works great…they both work great as a matter of fact. Loading the external swf’s without the alpha transition seems to be much more smooth, I even have one where there is a slight alpha transistion in the external swf and it loads with clogging things up. Yay!

With the mouse hide- did it have to be done your way because it was changing over multiple movieClips as opposed to just one? Because I just tried applying the code from a tutorial I had completed a while ago, though in that example there was just one main area where the mouse hide took place.

Seems as though setInterval and clearInterval are used quite a bit I suppose it might be good for me to remember that and learn more about why and when they are used.

I am feeling very good about this for now, so I thank you (again and again) very much!

Yes you basically have the reason.
setInterval is basically used instead of onEnterFrame.The numerical value refers to the number of 1/1000s of a second.So if you were to set it at 50, this would be the same as using onEnterFrame at 20 frames/sec. Good for having things going at different speeds. Im feeling good that you are feeling good. :puzzle:

Well it’s good that we are both feeling good. :wink: Not only do you solve people’s Flash problems, but you give emotional satisfaction as well…lol

I am going through possible scenarios for the question number movie clip that is loaded when a question is chosen. I think I am just going to use regular old movieclips with actual time line tweens etc, though it makes me feel like I’m cheating (not doing it through AS) That way I can control it as a whole rather than trying to mess around coordinating a movieClip with a text field, etc. I know it’s a basic way to do it, but it really doesn’t add too much to the file size. (About 1k for each clip) Once they are all made I will try the hard part which is setting is up so that the proper one loads when a question is chosen, and fades when an answer is chosen. I am sure you will be hearing back from me at that point.

edit: well I just added 4 more clips and I using the swap feature so it’s not even adding 1k per new mc. That’s not so bad to do it this way then right?

Well I am at that point - where I am trying to get the question number movieClip to load when a state is chosen. If you look at this and go as far as to choose a state after enter name, choose color, once you click a state you can see that all 10 of them come up together. That of course is the easy part. They should only come up one per question and will fade once an answer is chosen. (The number one shield does this)

Well I tried intergrating this idea into the current file with everything else that is going on and it is hard to follow, so I made a test file so that maybe I could understand how it even works before I go trying to add it into everything that is already going on. Well all I can get it to do is load shield10, and it loads automatically without even pressing any of the stateclips. I thought maybe it had to do something with the setInterval/clearInterval setup, but I have not been able to make anything else happen other than the described above. Could you take a look? Here it is.

At this point I have two other realizations. All states should probably be disabled until the user color is selected. I may be able to figure it out just kind of like to type these things out to you cause it seems to help my thinking process. One other problem is with the mouse hide. When a question comes up, some of the answers are over one of the states that the mousehide is set to work over. I guess maybe an if statement will have to be added to that to disable when a question is loaded and enable once an answer has been selected. What do you think?

I did realize one thing already in the shieldtest.fla-
They (the shield movieclips) were probably all loading, they were just loading on top of each other. So I check and they were cause I was setting the same _x value for all of them…duh!!

So I changed this:

function loadShield() {
for (var sh = 1; sh<shield.length; sh++) {
_root.attachMovie([“shield” + sh], [“shield”+ sh], sh+200);
_root[“shield” + sh]._x = 215 + 83.9;
_root[“shield” + sh]._y = 75;
}
};

To this:
function loadShield() {
for (var sh = 1; sh<shield.length; sh++) {
_root.attachMovie([“shield” + sh], [“shield”+ sh], sh+200);
_root[“shield” + sh]._x = 215 + 83.9 * sh;
_root[“shield” + sh]._y = 75;
}
};

So at least now they are all loading but without an onPress triggering the load…it’s just when the movie loads. Even with all your code as examples I am kind of surprised I have even made it that far…lol

Because you are using attachMovie rather than loading in seperate swfs, you didn`t need the preloading code nor the interval which moniters.

in the test file something like this.
//not sure you need an array
//there is no shield0 so state0 does not work
shield = ;
for (var i = 1; i<11; i++) {
shield.push(this[“shield”+i]);
trace([shield]);
this[“mystate”+i].ivar = i;
this[“mystate”+i].onPress = function() {
loadShield(this.ivar);
};
}
function loadShield(iv) {
_root.attachMovie([“shield”+iv], [“shield”+iv], 200);
_root[“shield”+iv]._x = 215+83.9;
_root[“shield”+iv]._y = 75;
}

The other 2 problems which you mentioned should be fairly easy to fix.Just set enabled to false for all states at the start of the code, then enable when a colour is selected.(probably have to disable them in the pressed array after enabling all in case your user changes colour in midst game)
Same with the mouse thing. Just use a loop to disable the 0->19 states, then enable them again.

Thanks Stringy, I will give it a try. I did realize that the preloading/interval things were not doing anything yesterday and did get to the point where I was clicking on a state and it was returning undefined. At least I was getting some sort of a reaction out of the onPress action even though it was not set up correctly yet.

I started on the disable all states until color is selected. When I do that it messes with the arrow image I have on the stage that shows when the mouse hide takes place…not sure why… I did not get that far along with that though so maybe once all things are in place it will be fine.

Well the loadShield code works (as yours always does) but I think I did not explain well what I hoping to achieve with this. I did not try doing anything with the ivar (like you had done with the questions in the working file) because it does not need to know which state number is clicked. Only to know to load a clip dependant upon how many times a state has been clicked on. In other words, Let’s say I choose mystate23 for my first state. When that state is clicked, the question associated with mystate23 is loaded, along with shield1. (I did realize my mistake of leaving a shield0 out once I had made them all, did not know if that would mess things up or not since I do know that all arrays are supposed to start with zero…)

Anyway back to the example. Once answer is chosen for mystate23, the shield1 clip fades but stays on the stage where it is. Then, I choose mystate37 as my next state…the question 37 of the question array loads along with shield2, once the answer is chosen shield2 fades and stays in place on the stage. This process repeats up to 10 times. This is unless the person gets 6 questions correctly answered before that which will end the game.

just done this quickly with the test file, see if it is a little nearer

shield = ;
for (var i = 0; i<10; i++) {
this[“mystate”+i].onPress = function() {
loadShield();
};
}
function fade(clip) {
clip.onEnterFrame = function() {
clip._alpha -= 2;
if (clip._alpha<=50) {
clip._alpha = 50;
delete clip.onEnterFrame;
}
};
}
ij = 1;
ji = -1;
function loadShield() {
clip = _root.attachMovie(“shield”+ij, “shield”+ij, 200+ij);
clip.ivar = ij;
clip._x = 100+clip._width*clip.ivar;
clip._y = 75;
shield.push(clip);
fade(shield[ji]);
ij++;
ji++;
}

much nearer…thanks! I don’t need it to fade until the answer is chosen but I already tested and that part is easily taken out.

oh well maybe tomorrow…but I doubt it :wink:

Okay now here’s another puzzler (for me) which you have already partially answered. I want the shield that has loaded with the question to fade when an answer to that question has been chosen. In the original code you provided for the shield, the fade was worked in but it fades the shield when another question is selected, rather than when the answer is selected. Which I guess isn’t bad, but would prefer it to fade with the answer.

This leaves the problem of where do I put the fade function…on the main timeline or the mystatequestion timeline? Also, since it is set up with some different variables (in the load function) how do I work that into the fade function only? Here is the original code:

shield = [];
for (var i = 0; i<10; i++) {
this[“mystate”+i].onPress = function() {
loadShield();
};
}
function fade(clip) {
clip.onEnterFrame = function() {
clip._alpha -= 2;
if (clip._alpha<=50) {
clip._alpha = 50;
delete clip.onEnterFrame;
}
};
}
ij = 1;
ji = -1;
function loadShield() {
clip = _root.attachMovie(“shield”+ij, “shield”+ij, 200+ij);
clip.ivar = ij;
clip._x = 100+clip._width*clip.ivar;
clip._y = 75;
shield.push(clip);
fade(shield[ji]);
ij++;
ji++;
}

I took out the fade, this is what I had the questions about earlier today:

ij = 1;
ji = -1;
function loadShield() {
clip = _root.attachMovie(“shield”+ij, “shield”+ij, 200+ij);
clip.ivar = ij;
clip._x = 0+clip._widthclip.ivar1.25;
clip._y = 75;
shield.push(clip);
ij++;
ji++;
}

then call loadshield(); when mystate# is pressed.

Anyway I think there are so many possibilities for the fade, none of them right so I am looking for guidance from you on the right way.

several ways you could do this, heres 1.

inside the myStateQuestion checkradio function
_root.fade(_root.targ);

put the fade function on the main timeline and change the other function to
function loadShield() {
clip = _root.attachMovie(“shield”+ij, “shield”+ij, 200+ij);
clip.ivar = ij;
clip._x = 0+clip._widthclip.ivar1.25;
clip._y = 75;
_root.targ = clip
shield.push(clip);
ij++;
ji++;
}

so we are storing a value of the last flag in a variable targ.

okay well I tried this and now the shield is not loading to begin with when the question is loading…considering this is me though I will take a look and recheck things. It may something simple I am overlooking…

I wonder if you have changed something else by mistake, i am pretty sure it should work.