Bitwise is not working Y?

can some one tell me why the script in the movie as shown in the attached file bitwise.gif is not working.

I have used 2 instances of buttons and a movieclip (orange box) wiht an onclipEvent( enterframe) handler. the goal was to use the movie clip to monitor if the buttons are clicked once or twice. the movie works if I use the button with (1<<0) only

Hmm, I think you are using the bitwise operators wrong. They look wrong to me at least, but that isn’t my area.

movieclip.prototype.doubleClick = function(speed) {
	if (getTimer()-oldTime<=speed) {
		return (true);
	oldTime = getTimer();
	clickcount = 0;
movieclip.prototype.test = function() {
	if (getTimer()-timestamp>=250 && clickcount == 1) {
		results = "Single Click";
		clickcount = 0;
setInterval(test, 10);
Button.prototype.onPress = function() {
	if (doubleClick(250)) {
		results = "Double Click";
	timestamp = getTimer();

The above code is a way to tell if the user double clicked or single clicked (which is what it sounded like you wanted to do, I could have misunderstood though). Add those actions to a frame, create a button on the main timeline, and create a dynamic text area with the var name “results” (without quotes).

Then test your movie.

Note: This code originally came from

If I did misunderstand what you tried to do, can you please post your .fla?

Ok, I am not going to delete my last post, just so everyone can see how much of a [email protected]$$ I am, but I decided to test your code AFTER I posted, which was a very stupid mistake.

I see you are trying to toggle things on and off.

I still think you are going about it all wrong.

Here try this…

On the frame add this action…

count = 0;

Now on your toggle pressed button add these actions…

on (release) {
	_root.count = 0;

And on your toggle released button add these actions…

on (release) {
	_root.count = 1;

Now on your movie clip…add these actions…

onClipEvent (enterFrame) {
	if (_root.count == 0) {
		trace("toggle pressed");
	} else if (_root.count == 1) {
		trace("toggle released");

I tested it and I think that this is actually what you wanted to do.

Of course the count = 0 is to set a default from the beginning (you can change it to 1 if you want it to be released first, or just switch the way the numbers work if you want). You can remove that if you don’t want anything set as default when you load the movie.

whats the meaning of all that prototype stuff? i’ve seen it in books but never really read it? it just looks like hes attaching events to clips. but that can be done with clip.onEnterFrame for example…

Best place to learn about prototypes…

Go here

And click on the link that says…

"using prototypes instead of functions "

you can toggle things cleverly with:

   toggledVariable = !toggledVariable;

here’s how i detect double clicks:

Mouse.onMouseDown = function(){
   this.dblClick = (getTimer() - this.lastClick < 200);
   this.lastClick = getTimer();

then on a button:

      //do stuff

works pretty good, and it’s real simple.

And sbeener is the asbolute masta flasha =)