00:00
00:00
Newgrounds Background Image Theme

Rico-Daima68 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS2 codes that are broken

409 Views | 3 Replies
New Topic Respond to this Topic

AS2 codes that are broken 2024-03-05 10:21:06


so as i am learning to code using Action Script 2, i am finding that on both my pc and on the browser there are some lines of code that will not function for me. On major example is that && statements will work, but not || or statements.


I was wondering if this is not working with everyone, and if this should be a reason to make a game with AS3 instead?


At 3/5/24 10:21 AM, scottwjsm wrote:so as i am learning to code using Action Script 2, i am finding that on both my pc and on the browser there are some lines of code that will not function for me. On major example is that && statements will work, but not || or statements.

I was wondering if this is not working with everyone, and if this should be a reason to make a game with AS3 instead?


It's been a while since I used those operators in AS2 so I can't say, but I think it worked for me. I think what didn't work for me was ||=, though.


There's many more reasons to switch to AS3, but in terms of convenience functions, not having the following really made it a lot more tedious to work with AS2 (not an exhaustive list, just the ones I could think off the top of my head):

Array.forEach
Array.map
Array.some
Vector.<X>
Array.indexOf

The last one is particularly egregious. IndexOf! Fucking indexOf is missing! You have to implement your own convenience methods for finding an item in an array!


But besides that, the AS3 event system is much, much easier to work with than AS2's. Even though they're similar in many respects, the structure of the AS3 event system is much cleaner, and so you can organize your code to make it easier to read. As opposed to the AS2 method which requires a lot more discipline to get working correctly.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature

Response to AS2 codes that are broken 2024-03-12 23:18:11


how about functions interfering with other functions? how well are you with as2?


At 3/5/24 11:46 AM, Gimmick wrote:
At 3/5/24 10:21 AM, scottwjsm wrote:so as i am learning to code using Action Script 2, i am finding that on both my pc and on the browser there are some lines of code that will not function for me. On major example is that && statements will work, but not || or statements.

I was wondering if this is not working with everyone, and if this should be a reason to make a game with AS3 instead?

It's been a while since I used those operators in AS2 so I can't say, but I think it worked for me. I think what didn't work for me was ||=, though.

There's many more reasons to switch to AS3, but in terms of convenience functions, not having the following really made it a lot more tedious to work with AS2 (not an exhaustive list, just the ones I could think off the top of my head):
The last one is particularly egregious. IndexOf! Fucking indexOf is missing! You have to implement your own convenience methods for finding an item in an array!

But besides that, the AS3 event system is much, much easier to work with than AS2's. Even though they're similar in many respects, the structure of the AS3 event system is much cleaner, and so you can organize your code to make it easier to read. As opposed to the AS2 method which requires a lot more discipline to get working correctly.


Response to AS2 codes that are broken 2024-03-12 23:26:14


At 3/12/24 11:18 PM, scottwjsm wrote:how about functions interfering with other functions?

What do you mean, functions interfering with other functions? I have a vague idea of what you mean but perhaps some examples would make it clearer.

how well are you with as2?

Haven't programmed with it in earnest for like 4 or more years but I've worked with it more or less enough to know most of it with a little bit of aid from the AS2 reference.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp

"Sit look rub panda" - Alan Davies

BBS Signature