· 2 min read

Syntax


So the first thing you may have noticed is that everything in AS2 that had an underscore in front of it no longer does in AS3. That is a MAJOR issues for all of us lazy coders that just want to copy and paste old AS 2 code into an AS3 document – it will fire all sorts of errors such as this one:

Warning: 1058: Migration issue: The property _x is no longer supported.  Use the DisplayObject.x property instead.

So lets say you have a FLA with a MovieClip on the Stage with an instance name of tester_mc and you want to set its x position to 89.

In AS2:

tester_mc._x = 89;

In AS3:

tester_mc.x = 89;

Another little tidbit to keep in mind is that all values that ran from 1 to 100 such as the alpha setting are now running from 0 to 1. If we use the same MovieClip from the last example and set it’s opacity to 50% here is the syntax (remembering to drop the underscore!).

AS2:

tester_mc._alpha = 50;

AS3:

tester_mc.alpha = 0.5

These are very simple changes but they have a major impact if you miss one – your program will not run and eventually you will go crazy and want to fight the elderly.

Since we’re on the topic of errors, I have been working to document all of my encounters with both compiler and runtime errors in Flash.

Leave a Reply

Your email address will not be published. Required fields are marked *


Keep going