Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to test a piece of actionscript3 code without playing a movie?

Contributor ,
Sep 28, 2013 Sep 28, 2013

Hi All,

I'm a learning novice.

When I was working in Director, I could type a line of code (an 'if/then' statement, for example) into a window and hit enter and it would run and show me if the code was functional. It would send results to an 'output' window (the sum of a math function, for example) or I could have the system produce a beep, etc.

Is there anything comprable in Flash CS5?

Thanks

TOPICS
ActionScript
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 28, 2013 Sep 28, 2013

The closest thing is just creating a new document and typing code on the timeline. I do that all the time.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 29, 2013 Sep 29, 2013

Use the trace function. The code will always have to be compiled.

Code that doesn`t afflict the stage will result in an empty movie

trace(1+2)

//outputs 3

import flash.system.Capabilities;

trace(flash.system.Capabilities.screenResolutionX);

//outsputs horizontal resolution

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2013 Sep 30, 2013

Ok I'll continue to use new, stripped down movies to test.

Thanks Aaron and moccamaximum.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 30, 2013 Sep 30, 2013

There are several ways. When you're working in an ActionScript Class in the Flash IDE, there's a little check box you can click that will check to see if the syntax is valid.

If you create a Flash Project in Flash Builder and leave "Build Automatically" on, it will compile the project every time you save a change, reporting problems to the error window. This can be time-consuming, so I usually leave that off and just compile when I need to useing Ctrl-B (Build all).

You can also create and run unit tests. I might at one point have recommended that you use FlexUnit with Flash Builder, but the process for getting that set up is not trivial, particularly if you've never used FlexUnit with Flex. So today I'd say you might want to look at ASUnit. Unit tests are a good practice anyway.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 30, 2013 Sep 30, 2013
LATEST

Thanks Amy.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines