-
clicks per second
i need a fla file that shows the clicks per second some one is getting. any help?
-
Banned
Hi,
If strict accuracy is not neccessary,this will probably work. It is based on a setInterval call of 1000 milliseconds....
code:
clickCount = 0;
_root.onMouseDown = function() {
clickCount++;
}
function countTrack() {
trace(clickCount+" clicks per second");
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
-
cool. thanks. will that display to the user the amount of clicks he has?
-
Banned
no, that just traces the value to the output window for testing. You would need to create a textfield and assign the variable to the text property of the textfield...
myTextfield.text=clickCount+" clicks per second";
-
ok it displays "0 clicks per second" but the 0 wont change
Last edited by sk8rjess; 12-10-2005 at 08:33 PM.
-
and then, how would i display the highest click the person has?
-
grrr i just cant get it to work!
-
Senior Member
Hi
NTD's example shows a function that has a setInterval action which every second records how many clicks occur then resets the clickCount variable back to ...0....after the interval has occured.....
If you just need to know how many clicks occur....you could create a dynamic text box and call it ....howManyClicks....for example
Then put this in the timeline....
code: howManyClicks = 0;
_root.onMouseDown = function() {
howManyClicks += 1;
};
Last edited by hum; 12-11-2005 at 03:21 PM.
-
Banned
Hi,
code:
clickCount = 0;
_root.createTextField("myTextField", 1, Stage.width/2, Stage.height/2, 150, 20);
myTextField.background = true;
_root.onMouseDown = function() {
clickCount++;
}
function countTrack() {
trace(clickCount+" clicks per second");
myTextfield.text = clickCount+" clicks per second";
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
-
thanks guys... but i dont think i explained what i ment. i need it to display how many clicks per second the person is getting, and then in another text box, display the most clicks per second the user has had.
-
Banned
code:
clickCount = 0;
_root.createTextField("myTextField", 1, Stage.width/2, Stage.height/2, 150, 20);
_root.createTextField("totalTextField", 2, Stage.width-150, Stage.height/2, 150, 20);
myTextField.background = true;
totalTextField.background = true;
_root.onMouseDown = function() {
clickCount++;
if (clickCount<highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
}
function countTrack() {
trace(clickCount+" clicks per second");
myTextfield.text = clickCount+" clicks per second";
totalTextField.text="Fastest clicks per second="+highCount;
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
Last edited by NTD; 01-25-2006 at 05:36 AM.
-
i got these errors with that:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 17: ')' expected
highCount = highCount;
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 20: 'else' encountered without matching 'if'
else {
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 26: Unexpected '}' encountered
};
Total ActionScript Errors: 3 Reported Errors: 3
-
Senior Member
Hi
code: clickCount = 0;
_root.createTextField("myTextField", 1, Stage.width/2, Stage.height/2, 150, 20);
_root.createTextField("totalTextField", 2, Stage.width-150, Stage.height/2, 150, 20);
myTextField.background = true;
totalTextField.background = true;
_root.onMouseDown = function() {
clickCount++;
if (clickCount < highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
};
function countTrack() {
trace(clickCount+" clicks per second");
myTextfield.text = clickCount+" clicks per second";
totalTextField.text = "Fastest clicks per second="+highCount;
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
-
hmmm alright well thanks for all your alls help but once again, i need help. this is what i have sofar
Code:
clickCount = 0;
_root.createTextField("myTextField", 1, Stage.width/2, Stage.height/2, 150, 20);
_root.createTextField("totalTextField", 2, Stage.width/2, Stage.height/2, 150, 20);
myTextField.background = false;
totalTextField.background = false;
_root.onMouseDown = function() {
clickCount++;
if (clickCount < highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
};
_root.onMouseUp = function() {
clickCount++;
if (clickCount < highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
};
function countTrack() {
trace(clickCount+" shots per second");
myTextfield.text = clickCount+" ";
totalTextField.text = ""+highCount;
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
how would i make it like, after the user hits 10 shots per second, it would double how many it adds to each click. heh please help, i am absolutely clueless
-
Banned
Hi,
Can you actually achieve 10 clicks per second? Anyway, you could use an if statement to check if the highcount variable is greater than 10. Something like....
code:
if(clickcount>10&&clickcount>highcount){
clickcount+=2;
}else{
clickcount++;
}
-
it doesnt do anything, i have:
Code:
clickCount = 0;
_root.createTextField("myTextField", 1, Stage.width/2, Stage.height/2, 150, 20);
_root.createTextField("totalTextField", 2, Stage.width/2, Stage.height/2, 150, 20);
myTextField.background = false;
totalTextField.background = false;
_root.onMouseDown = function() {
clickCount++;
if (clickCount < highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
};
_root.onMouseUp = function() {
clickCount++;
if (clickCount < highCount) {
highCount = highCount;
} else {
highCount = clickCount;
}
};
function countTrack() {
trace(clickCount+" shots per second");
myTextfield.text = clickCount+" ";
totalTextField.text = ""+highCount;
clickCount = 0;
}
traceCount = setInterval(countTrack, 1000);
if(clickcount>10&&clickcount>highcount){
clickcount+=2;
}else{
clickcount++;
}
-
I know what you are doing
You are making a paintball game to see who can shoot the fastest. I guess you do not like the ego or dm5 versions floating around huh However, there are already 2-3 good ones out there. He is basically wanting this:
Shows how many shots per second you can achieve. It keeps track of the highest shot per second average you achieve in a seperate window. The highest I can achieve without cheating is 19 bps.
-
Banned
Hi,
I am not sure what exactly is trying to be done here, but the code I posted works correctly for FlashMX. What version of Flash are you using?
-
lol phantomhitman, yea i am. i haave had one done for a while but now i would like to do one with ramping. Im using Flash MX 2004 Pro
-
hmmm. i have been looking at this, and i understand what everything does, but im clueless why it isnt working
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|