News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

Differecnce between AS2 and AS3?

Farted by Camel Cigarettes Clock, June 29, 2013, 06:07:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


buttplug

AS3 is apparently faster/easier to use (unless you already know AS2 I suppose)

paging RomanClock ITT

Camel Cigarettes Clock

Everything looks the same to me :/

PhantomCatClock

AS2 is more forgiving if you want to churn out crap without making sure your code looks perfect or everything's in an event. AS3 feels more scriptish but you can do a lot of things that can't be done in AS2 without making an external .as


If you just want to make things that could've existed in Flash before 2007 and realize an unnoticeably slower script isn't going to fix the VM or ridiculous graphics calls, use AS2. If you want to have dignity use AS3, but then your options for people to ask scripting questions on these forums will be considerably smaller

RomanClock

The biggest difference that I noticed is AS3 is strongly typed, meaning you have to define what a variables type is. Another major difference was implementing continuously executing code and the placement of code was restricted to keyframes and AS files. It's also much faster and encourages better object oriented programming practices. AS2 was more similar to Python, while AS3 is more similar to Java. Overall AS3 offers more options, flexibility, and power by moving towards a proper programming language format instead of a traditional scripting language (which incidentally might make it more difficult for beginners to pick up).

For example, these 2 code snippets do the same thing:
AS2
q = 0;
this.onEnterFrame = function() {
q++;
trace(x);
}
AS3
addEventListener(Event.ENTER_FRAME, plus);
var q:Number = 0;
function plus(e:Event)
{
q++;
trace(q);
}
lemayo lol :soups: