# Error Message, what does it mean?

**URL:** <https://forum.kirupa.com/t/error-message-what-does-it-mean/161822>\
**Category:** flash\
**Created:** [September 7, 2005, 1:15pm UTC](https://forum.kirupa.com/t/error-message-what-does-it-mean/161822 "2005-09-07T13:15:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Recognize](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Recognize](https://forum.kirupa.com/u/Recognize)\
**Post date:** [September 7, 2005, 1:15pm UTC](https://forum.kirupa.com/t/error-message-what-does-it-mean/161822/1 "2005-09-07T13:15:31Z")

</div>

Hello,

does anyone understand what this error message means:

Symbol=A Button, Layer=sub link 1, Frame=2: Line 1: Statement must appear within on handler  
**but2.onPress = function() {**

it comes up when I try to test my movie. This code is applyed to a button which is inside a mc (movie clip).

here is the full code:

//but2 is the button instance name  
but2.onPress = function() {  
if (\_root.currMovie == undefined) {  
\_root.currMovie = “section3”;  
\_root.container2.loadMovie(“section3.swf”);  
} else if (\_root.currMovie != “main”) {  
if (\_root.container2.\_currentframe\>=\_root.container2.midframe) {  
\_root.currMovie = “section3”;  
\_root.container2.play();  
}  
}  
}

Thanks in advance :thumb2:
