Forum Topic: As2 Vs As3

(313 views • 27 replies)

This topic is 1 page long.

<< < > >>
Resigned

phnmnL

Reply To Post Reply & Quote

Posted at: 11/11/09 05:37 AM

phnmnL FAB LEVEL 05

Sign-Up: 08/18/09

Posts: 4

Hello people of Newgrounds!

I have a quick question for the more experienced flash game developers on this website- is there any real reason I should code a game in AS3 rather than AS2? Are there benefits in the code design that will save me time in the long run? Are there features on NG that require AS3?

Reason I'm asking is because I'm quite proficient with AS2, but a lot of AS3 baffles me, learning it would be an entire task upon itself.

Many thanks in advance!


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/11/09 05:46 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

Learning AS3 despite popular belief isnt that hard, i moved over and was loving it in 2 days and yes there are many benefits and muth more things you can do , just compare the two indexes for quick proof, but the main reasons you want to move are :

1. Performance (espicially if you start using raster and blitting)
2. Orginization , yes AS2 has classes but AS3 classes work hell better and generally even timeline code is more organized

one more thing , you may be discouraged at the fact most AS3 requires a little extra code but is one extra line of code out of a thousand going to kill you ?

Just look at the first few characters in my sig, they say everything , AS3 FTW.

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Glaiel-Gamer

Reply To Post Reply & Quote

Posted at: 11/11/09 05:51 AM

Glaiel-Gamer NEUTRAL LEVEL 28

Sign-Up: 12/28/04

Posts: 8,074

Learn AS3.

It's stricter which makes it harder to learn if you're used to as2 but is MUCH MUCH nicer in the long run.

AS2 promotes bad coding practice by allowing it. Stuff like not declaring the type of a variable

var A = 1 //makes A a number
A = textbox.text // read in the number "4" from a text box
A += 1 //increment A by 1
trace(A) //outputs 41, wtf??? cause reading it in from a textbox converted it to a string

So just learn AS3, you'll save yourself a ton of time tracking down "bad code" bugs when the language specifically disallows much of it.

Also it's about 100x faster (not graphics that's not code... keep that in mind)


None

phnmnL

Reply To Post Reply & Quote

Posted at: 11/11/09 06:01 AM

phnmnL FAB LEVEL 05

Sign-Up: 08/18/09

Posts: 4

Convinced! extra performance and organization is certainly worth the effort.

I've definitely hit that hurdle before in your example Glaiel, I'm glad that kind of thing is obsolete in AS3.

Thanks a bunch guys


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/11/09 06:04 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

this one plain fact gives me enough reason to prever AS3 massivly.

i wrote a speed test, in as2 and in as3. Both are identicle, litrally copied and pasted the code (as3 offers faster ways to loop, but i chose not to use them in this example)

var k:Number = getTimer()
for(var i:Number = 0; i<5000000; i++){
	i = i
}
trace(getTimer()-k)

AS3's speed: 46 m/s

AS2's speed: 13919 m/s

AS2 nearly crashed! it took 14 seconds to run this loop compaired to 46 milliseconds (0.046 seconds) in AS3. Also, it only took me a week to feel about as comfortable in AS3 as i was in AS2

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

phnmnL

Reply To Post Reply & Quote

Posted at: 11/11/09 06:09 AM

phnmnL FAB LEVEL 05

Sign-Up: 08/18/09

Posts: 4

That's an epic difference right there. cheers!


None

Reprah

Reply To Post Reply & Quote

Posted at: 11/11/09 06:30 AM

Reprah EVIL LEVEL 13

Sign-Up: 11/11/04

Posts: 41

Hey, cool, I just switched over to the ruination of ALL MY DYNAMIC TEXT.

ohman AS3 IS AWESOME RIGHT GUYS

BBS Signature

None

Reprah

Reply To Post Reply & Quote

Posted at: 11/11/09 06:39 AM

Reprah EVIL LEVEL 13

Sign-Up: 11/11/04

Posts: 41

So it seems like AS2 is better for frame-based work, and AS3 is better for core programming. As long as you get in to the habit of strong-typing your variables AS2 will fit the bill just fine. Apparently AS3 doesn't have global variables, either.. I think I'll keep my shit firmly with AS2.

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/11/09 06:48 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

At 11/11/09 06:39 AM, Reprah wrote: So it seems like AS2 is better for frame-based work

Disagree. Firstly, read my above post on the speed difference and then tell me that such a massive gap does not matter. Secondly, what do you mean by global variables? I never used them, because i cant see any particular use for them

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

grafik2d

Reply To Post Reply & Quote

Posted at: 11/11/09 07:25 AM

grafik2d NEUTRAL LEVEL 10

Sign-Up: 06/29/04

Posts: 182

Here this is a good place to start in as3 thought it will be painfully slow pace for anyone who already know as2, but at least you'll know how to make most of what you already knew.


None

ProfessorFlash

Reply To Post Reply & Quote

Posted at: 11/11/09 09:03 AM

ProfessorFlash DARK LEVEL 24

Sign-Up: 10/06/07

Posts: 813

At 11/11/09 06:39 AM, Reprah wrote: So it seems like AS2 is better for frame-based work, and AS3 is better for core programming. As long as you get in to the habit of strong-typing your variables AS2 will fit the bill just fine. Apparently AS3 doesn't have global variables, either.. I think I'll keep my shit firmly with AS2.

I've already switched to AS3, but when I was doing AS2, I never needed global variables. You are doing it wrong if you think you need global variables.


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/11/09 09:49 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/11/09 06:30 AM, Reprah wrote: Hey, cool, I just switched over to the ruination of ALL MY DYNAMIC TEXT.

ohman AS3 IS AWESOME RIGHT GUYS

Is this supposed to be sarcasm ? Dynamic text is better in AS3

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 11/11/09 11:02 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,427

To spell it out for people like Reprah or whatever, you might like AS2* better when you don't know what you're doing. No, it's not actually better by any measure of quality. I'm sorry AS3 let you know you're a dumbfuck, stop telling other people it sucks.

*AS1 actually, AS2 is in fact similar to AS3, but it's something like backwards-compatible, but you're not actually using AS2.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Reprah

Reply To Post Reply & Quote

Posted at: 11/11/09 11:46 AM

Reprah EVIL LEVEL 13

Sign-Up: 11/11/04

Posts: 41

Alright, fuck you, pumpkin. You just stepped the line.

1) First, I do not appreciate being typified with anyone including people who have a problem with AS3.
2) Second, I'm no devout anti-AS3 missionary. I do not give a fuck what script this guy uses.
3) Third, I don't do actionscript. All I know is I switch over to AS3 my shit goes haywire, so I'm not overly keen.

The rest of the point you were trying to make becomes muddled with the introduction of the asterisk, but the gist is more personal attacks. Next time you want to make a compelling argument don't start hitting out at what you assume to be the opponents of your opinion--man the fuck up, please.

BBS Signature

None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/11/09 12:02 PM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/11/09 11:46 AM, Reprah wrote: -man the fuck up, please.

Gust is twice the man youll ever be, he speaks the facts and even if they come off harshly they're still facts , the point is that if you dont know anything about AS3 then you cant compare the two , ergo you should GTFO of this thread and not fill the minds of new people with "well AS2 AS2 AS2 AS2 " no one else cares if your shit goes everywhere, its YOUR shit deal with it, everything you've said in this thread has been useless and stupid.

But to simplify on a nicer note :
MrA has lived his entire life in russia , MrB asks him "Hey MrA what do you think of Jamaica!"
Can you see the predicament ?

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Reprah

Reply To Post Reply & Quote

Posted at: 11/11/09 12:27 PM

Reprah EVIL LEVEL 13

Sign-Up: 11/11/04

Posts: 41

The points Reprah made ------------------------> X

X <---------------------- hdxmike

BBS Signature

None

onezerothrice

Reply To Post Reply & Quote

Posted at: 11/11/09 01:08 PM

onezerothrice NEUTRAL LEVEL 01

Sign-Up: 07/16/09

Posts: 30

@phnmnL, and anyone else, may I suggest that you do yourself a favor and learn mxml component structure in flex alongside AS3? You'll be setting yourself up to have top level Flash programming skills.

Flash was originally created primarily for animation. Even with the advancements in syntax over the years, the Flash IDE is still based on a timeline and has one of the worst text editors ever. Commercial game programming is done completely in code. That's why most software engineers (those who know c++, java and such) gravitate towards Flex. It's free, you can create the entire application in your favorite text editor, and most importantly it gives you true compile time errors and warnings.

The two games in the portal I played this morning set off errors in my debug version of Flash Player. This is probably because they were built in the Flash IDE, where errors don't stop the running of the program. I guess I'm just an advocate for clean code, since in my job, I see so many bad coding examples cross my desk, and many times I have to spend hours fixing someone else's mistakes. Flex just minimizes those mistakes for the developer.


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 11/11/09 01:10 PM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,427

At 11/11/09 11:46 AM, Reprah wrote: Alright, fuck you, pumpkin. You just stepped the line.

Damn, I must've ticked him bad, he's gonna get busy showing me where the stuff's at. Here comes his main point:

3) Third, I don't do actionscript. All I know is I switch over to AS3 my shit goes haywire, so I'm not overly keen.

Yup.

The rest of the point you were trying to make becomes muddled with the introduction of the asterisk, but the gist is more personal attacks. Next time you want to make a compelling argument don't start hitting out at what you assume to be the opponents of your opinion--man the fuck up, please.

Sorry about that. I wasn't talking to you specifically (and you didn't say anything particularly annoying), but to the other kids who always wind up in these threads complaining about AS3.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/11/09 01:11 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

At 11/11/09 12:27 PM, Reprah wrote: The points Reprah made ------------------------> X

X <---------------------- hdxmike

not really.

Before this just becomes a massive flame war will everyone refrain from posting?
this is starting to feel like one of those anoying facebook threads were people just want fucking shut up :l

anyways, i know gustTheAsGuy can get you pissed of, but aside from the personal attacks his shit is never wrong.

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

phnmnL

Reply To Post Reply & Quote

Posted at: 11/11/09 06:52 PM

phnmnL FAB LEVEL 05

Sign-Up: 08/18/09

Posts: 4

lol!

I probably shouldn't have named this thread AS2 vs AS3, it wasn't made to ignite a flame war. If you don't have anything necessarily constructive then don't bother posting.

@onezerothrice Thanks for your advice, I'll certainly look into flex and mxml and see what they bring to the table.

Thanks to everyone that offered help!


None

mulatto401

Reply To Post Reply & Quote

Posted at: 11/11/09 07:36 PM

mulatto401 NEUTRAL LEVEL 02

Sign-Up: 05/02/06

Posts: 164

AS3 is what AS2 should have been, its a much better approach to a OOP language. IMO AS2 was simply a hack, a means to get things working. People complain about how AS3 is harder and they can't get it to work.....it's because AS3 is helping you make better code and stopping you from writing faulty code vs having AS2 allow you to compile and then have many bugs in your games.

I've seen games in AS2 that will glitch once or twice on a certain part of a game and then won't glitch at all or become hard to replicate the glitch....that is because AS2 is not a reliable language. Sure if you know what your doing AS2 works fine, but with AS3 it tightens things up.

So if your a real programmer and not just someone who wants to put things together, stick with AS3....otherwise get lost in messy AS2

:)

Current Project: Defend Your Cheese (www.thegameproject.com)


None

Deathcon7

Reply To Post Reply & Quote

Posted at: 11/11/09 08:14 PM

Deathcon7 NEUTRAL LEVEL 21

Sign-Up: 10/01/03

Posts: 5,870

It doesn't seem like anyone has mentioned this but AS3 is more fun to program. The technique it enforces reduces the likeliness of bugs or bad coding which makes it a lot more streamlined. It also provides for some unique problems and is flexible enough to work around them. If you're the problem solving type, I think AS3 will be a lot more suited to you needs.

Plus, there's the generic argument that you should always stay up to date with a language as you don't want to use deprecated code as it could stop being used suddenly and you'd be screwed.


Resigned

K-Guare

Reply To Post Reply & Quote

Posted at: 11/12/09 12:08 AM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,435

when I have a runtime error in AS2,
I have to look through the whole effing thing to find out what's wrong.
AS2's simplicity makes me angry,
It just kind-of ignores errors.
If I wanted that to happen, I'd but my code in a try block.

:3

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

Shouting

hdxmike

Reply To Post Reply & Quote

Posted at: 11/12/09 03:32 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/12/09 12:08 AM, K-Guare wrote: when I have a runtime error in AS2,
I have to look through the whole effing thing to find out what's wrong.
AS2's simplicity makes me angry,
It just kind-of ignores errors.
If I wanted that to happen, I'd but my code in a try block.

K-Gaure , you still use AS2 !? i never knew.

Also to whats his name yeah i geuss AS3 is more fun to programm i find it much easier to get an AS3 project up and running and then it just gets better because im not wasting time error fixing

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 11/13/09 03:39 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,435

At 11/12/09 03:32 AM, hdxmike wrote: K-Gaure , you still use AS2 !? i never knew.

Oh no, just saying why I prefer AS3 instead. ;)
Sorry, I wasn't really being specific.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

Happy

LifeinClocktopia

Reply To Post Reply & Quote

Posted at: 11/13/09 04:13 PM

LifeinClocktopia DARK LEVEL 05

Sign-Up: 09/05/09

Posts: 46

I prefer AS2. It is much easier to learn and to operate it.


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/14/09 09:15 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/13/09 04:13 PM, LifeinClocktopia wrote: I prefer AS2. It is much easier to learn and to operate it.

If you've never learned how to program AS3 then how the hell can you say AS2 is easier to operate ?

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 11/14/09 09:33 AM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,607

At 11/13/09 04:13 PM, LifeinClocktopia wrote: I prefer AS2. It is much easier to learn and to operate it.

facts speak for them selves

as i posted above in more detail:

AS3's speed: 46 m/s

AS2's speed: 13919 m/s

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 07:45 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!