Syntax errors!?!?!

Error Symbol=GUN, layer=Next, frame=1:Line 1: Statement must appear within on handler
this.onRelease = funtion()

Error Symbol=GUN, layer=Next, frame=1:Line 3: Syntax error.
this.rewind = false;

Error Symbol=GUN, layer=Next, frame=1:Line 2: Statement must appear within on handler
{

Error Symbol=GUN, layer=Next, frame=1:Line 4: Syntax error.
play();

Error Symbol=GUN, layer=Prev, frame=1:Line 1: Statement must appear within on handler
this.onRelease = function()

Total ActionScript Errors: 5 Reported Errors: 5

I’m still fairly new to flash but I just CANNOT find why this code is not working. Especially since it is mostly cut and pasted from a document where it works perfectly. WTF is wrong???

try


on(release) {
// disco
}

Ok guys I need to get to the bottom of this!

Here’s the code on my next button:

this.onRelease = funtion()
{
         this.rewind = false;
         play();
     } 

Here’s my previous button:

this.onRelease = function(){ 
this.rewind = true;
}

And lastly, the actions on the movieclip timeline:

onEnterFrame = function(){
	if(rewind == true){  		
prevFrame();       	}

}

change this.onRelease = funtion()
to this.onRelease = function();
:wink:

Why not put the button code on the main timeline?


 
this.mvGun.BackButton.onRelease = function()
{ 
    ..stuff..
};
 
this.mvGun.ForwardButton.onRelease = function()
{ 
    ..stuff..
};
 

If you can’t make a piece of code work, even when all logic says it should, then why not try finding a different way of doing it.

I have looked at the code in your fla posted on your other thread and one problem is the ‘this’ in your button code seemed to reference the gun not the button.

I quite often trace(this) to make sure i’m pointing at the right object, because it doesn’t always work as i imagine.

I was messing around with your fla and got this far…

omg thanks guys. I was losing my mind but I’ve finally got it to work. Ended up using the controller mc. I just deleted all the code and rewrote it completely, targeting evertything with absolute paths. Still don’t understand why it wasn’t working but the important thing is that I’ve done it finally. Cheers to all who helped. :thumb: