Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Flash - ActionScript

error: Statement must appear within on/onClipEvent handler

 
Jump to:  
 
webhildutza
PostPosted: Mon Jun 23, 2008 5:38 pm    Post subject: error: Statement must appear within on/onClipEvent handler
       
I'm getting this error Scene=Scene1, Layer=Layer 3, frame=1, Line1
Statement must appear within on/onClipEvent handler
shape.swapDepths(_root.getNextHighestDepth());

i'm using this code:
shape.swapDepths(_root.getNextHighestDepth());
//shape is a movie clip

stop();
this.attachMovie('bcPlayer','bcPlayerInstance',this.getNextHighestDepth());
//bcPlayerInstance._xscale = 75;
//bcPlayerInstance._yscale = 75;
bcPlayerInstance._y = -50;
bcPlayerInstance._x = -5;
//bcPlayerInstance is a movie clip

please help anyone knows what i'm doing wrong
 

 
DMennenoh **AdobeCommunit
PostPosted: Mon Jun 23, 2008 5:40 pm    Post subject: Re: error: Statement must appear within on/onClipEvent handl
       
Quote:
shape.swapDepths(_root.getNextHighestDepth());

swapDepths does not take a number, it takes another movieClip reference.

--
Dave -
LINK
Head Developer
LINK
Adobe Community Expert
LINK
 

 
Rothrock
PostPosted: Mon Jun 23, 2008 9:35 pm    Post subject: Re: error: Statement must appear within on/onClipEvent handl
       
Actually swapDepths can take either a moveclip or a number. That isn't the
problem.

The problem is that you put the code directly on a movie clip and not on a
timeline. Select the "shape" instance and bring up your Actionscript window.
Then click off the shape (and make sure you don't click on anything else except
empty stage.) Then select the frame in your timeline where you want the code.
You will know it is correct because at the top of the actionscript window it
will say Frame. Then paste your code.
 

 
DMennenoh **AdobeCommunit
PostPosted: Tue Jun 24, 2008 6:07 pm    Post subject: Re: error: Statement must appear within on/onClipEvent handl
       
Quote:
Actually swapDepths can take either a moveclip or a number. That isn't the
problem.

So it can! Sorry, just never used it with anything besides a clip ref, and
even then I really don't use it much as I like to keep track of things
myself.

Thanks

--
Dave -
LINK
Head Developer
LINK
Adobe Community Expert
LINK
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

spadki Meble stroje dessous Sennik