Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using actionscript 3 and I have used an external actionscript file (.as) for my game.

I would like the external actionscript file to be played at frame 2 (instead of frame 1, as it is an introductory page of the game) on the timeline.

How do I do that? I have been trying and looking for answers for hours, appreciate if you can help on this. Many thanks in advance!

share|improve this question

I'm assuming you're using the Flash IDE?

If your file isn't an Actionscript class, just use the include statement. Eg. on frame 2, write:

include "";

If you're using classes, there's an option in the Actionscript-3 settings, where you can specify a frame where classes should be imported to. So if your class is MyClass, just call something like this on frame 2:

var myInstance = new MyClass();

Maybe you'll even want a combination of the above.. eg. export all classes to frame 2 and also include an initialization script on frame 2.

share|improve this answer
thanks for ur reply! I have tried your second method, my file name is color_match so is it right that the code is var MyInstance = new color_match(); ? But I got an error msg: Error: Error #2136: The SWF file contains invalid data. at color_match/frame2() what should I do? Thanks. – Nail Dec 24 '12 at 5:56
@Nail How does your color_match file look like? Does it purely contain a class definition? Where is it located? Did you set the source-path in the actionscript properties? – bummzack Dec 26 '12 at 10:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.