Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable trouble

Status
Not open for further replies.

richvalve

Programmer
Mar 2, 2001
20
GB
Hi

I am having trouble. When the user rolls over the button I want the varialbe set to true. When the user has rolled over all the buttons, they will go to the end screen. Any ideas how I achieve this?!

I am trying things like onrollover set variable of button to TRUE etc, but don't seem to be getting very far.

Any advice appreciated a lot

Thanks

Richard
 
you could keep a running count and as each button gets rolled over add to the count then when that variable count reaches a certain number goto where you need to goto

[conehead]
 
Is this what you mean?

on (rollover){
var x = 1;
trace(x)
}

This command is on the buttons, then an action script saying when a-z = 1 goto final page. Or I guess a boolean yes/no would be better

Thanks
 
no more like say you have 10 buttons that need to be rolled over before you can go on, you give each button an as like:

on (rollover){
_root.counter++;
}

then have the movie looping through two frames inwhich the first you have something like:

if (counter == 10) {
gotoAndPlay(50);
}

then just disable each button after it is rolledover so they can not simply rollover the same button ten times:

on (rollover){
_root.counter++;
this.onRollover=null;
}

[conehead]
 
are there any other buttons in the movie to which you want to apply a rollover function. if not a prototype will work like a charm

let me know and if not i will write a simple button.prototype statement for you
 
There aern't any other buttons in the movie in which I want to aplly this rollover function. Just the 10 rollovered buttons

Hmmmm!
 
ok then
Code:
theButtons = ["but1", "but2", "but3"];
Button.prototype.onRollOver = function() {
	removeIt(this._name);
	checkEmpty();
};
function removeIt(someButton) {
	for (var i = 0; i<theButtons.length; i++) 
		if (theButtons[i] == someButton) 
			theButtons.splice(i, 1);
}
function checkEmpty() {
	if (theButtons.length == 0) gotoAndPlay(&quot;end&quot;)
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top