TurnsCoffeeIntoScripts
TurnsCoffeeIntoScripts

Reputation: 3918

Adobe flash can't run code in a frame

Ok, I'm fairly new to Flash, and I was trying to code some ActionScript now for the last two days. I can't a simple piece of code to work:

stop();

So... pretty simple right? ;)

I have a 10 frame animation, and I'm trying to make the animation stop at frame 5. So I select frame 5 from my timeline and then I open the action menu and I simply write stop(); in the window. When I run it I get the following error message:

In ActionScript 3.0 code cannot be placed directly on objects. Please select an object or use the Code Snippet panel to apply code to the current selection on stage.

I totally understand this is a simple question and the answer might be obvious, but I can't find it...

Thanks

EDIT:

I tried debugging it, and it works when in the debugger but not when in flash...

Upvotes: 1

Views: 3016

Answers (1)

Sr.Richie
Sr.Richie

Reputation: 5740

You're putting the code "on" the object, not allowed in AS3 (thx god). To avoid it, create a new layer and name it "code" (or whatever you want), and put the code in it

Upvotes: 2

Related Questions