# Syntax errors!?!?!

**URL:** https://forum.kirupa.com/t/syntax-errors/185021
**Category:** flash
**Created:** [April 10, 2006, 11:05am UTC](https://forum.kirupa.com/t/syntax-errors/185021 "2006-04-10T11:05:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Clark](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@Clark](https://forum.kirupa.com/u/Clark)
#### Post date: [April 10, 2006, 11:05am UTC](https://forum.kirupa.com/t/syntax-errors/185021/1 "2006-04-10T11:05:32Z")

</div>

**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???

---

<div class="post-metadata">

### Author: ![ramie](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@ramie](https://forum.kirupa.com/u/ramie)
#### Post date: [April 10, 2006, 11:52am UTC](https://forum.kirupa.com/t/syntax-errors/185021/2 "2006-04-10T11:52:18Z")

</div>

try

```auto

on(release) {
// disco
}

```

---

<div class="post-metadata">

### Author: ![Clark](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@Clark](https://forum.kirupa.com/u/Clark)
#### Post date: [April 10, 2006, 12:31pm UTC](https://forum.kirupa.com/t/syntax-errors/185021/3 "2006-04-10T12:31:21Z")

</div>

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

Here’s the code on my next button:

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

```

Here’s my previous button:

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

```

And lastly, the actions on the movieclip timeline:

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

}

```

---

<div class="post-metadata">

### Author: ![hybrid101](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hybrid101](https://forum.kirupa.com/u/hybrid101)
#### Post date: [April 10, 2006, 12:55pm UTC](https://forum.kirupa.com/t/syntax-errors/185021/4 "2006-04-10T12:55:40Z")

</div>

change this.onRelease = funtion()  
to this.onRelease = function();  
😉

---

<div class="post-metadata">

### Author: ![RichL](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@RichL](https://forum.kirupa.com/u/RichL)
#### Post date: [April 10, 2006, 12:58pm UTC](https://forum.kirupa.com/t/syntax-errors/185021/5 "2006-04-10T12:58:43Z")

</div>

Why not put the button code on the main timeline?

```auto

 
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…

---

<div class="post-metadata">

### Author: ![Clark](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@Clark](https://forum.kirupa.com/u/Clark)
#### Post date: [April 10, 2006, 3:42pm UTC](https://forum.kirupa.com/t/syntax-errors/185021/6 "2006-04-10T15:42:57Z")

</div>

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:
