Clock Crew

Community => Flash & Flash Accessories => Topic farted by: Camel Cigarettes Clock on June 29, 2013, 06:07:56 AM

Title: Differecnce between AS2 and AS3?
Post by: Camel Cigarettes Clock on June 29, 2013, 06:07:56 AM
Whats the difference?
Title: Differecnce between AS2 and AS3?
Post by: buttplug on June 29, 2013, 06:21:50 AM
AS3 is apparently faster/easier to use (unless you already know AS2 I suppose)

paging RomanClock ITT
Title: Differecnce between AS2 and AS3?
Post by: Camel Cigarettes Clock on June 29, 2013, 06:29:23 AM
Everything looks the same to me :/
Title: Differecnce between AS2 and AS3?
Post by: PhantomCatClock on June 29, 2013, 07:21:39 AM
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
Title: Differecnce between AS2 and AS3?
Post by: RomanClock on July 01, 2013, 04:50:46 AM
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);
}