Author Topic: AS3 "bad" programming practices  (Read 2213 times)

Offline peewee_RotA

  • Brobdingnagian Member
  • ***
  • Posts: 4152
  • Hi, I'm from the gov'ment and I'm here to help you
    • View Profile
  • Rated:
AS3 "bad" programming practices
« on: March 18, 2010, 07:07:20 AM »
You shouldn't attempt to remove object from itself - it is a bad practice, and in AS3 you can't do it for sure.

Object may be deleted (i.e. garbage collected) only if there are no references left to that object. Since references always get passed by value and object is generally not aware of which references to it exist, you can't delete object from itself. The only useful thing you can do is to create a method which will clean up all resources used by an instance. Such method will serve as a destructor, but you'll have to call it manually. Don't forget that event listeners will also prevent garbage collection unless you remove them

http://stackoverflow.com/questions/709365/how-do-i-delete-gc-an-object-in-actionscript-3

Aparently in Action Script 3 you are not supposed to clean up objects that your pointers reference. Technically they are not pointers, all variable names are just references to an object that is handled through the interpretor anyway, but this sounds like some backwards advice to me. In order to delete an object I have to delete all of it's pointers and allow the object to still exist.

Basically if I create an array of references (pointers) and fill that array dynamically with objects, every time that I want to pop an object from that stack it is bad practice to delete it. Does this confuse anyone else?
 :exqueezeme:
« Last Edit: March 18, 2010, 07:14:47 AM by peewee_RotA »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
GOTO ROTAMODS (rocketgib)
GOTO ROTAMAPS (fireworks)
HappyFriar- q2server.fuzzylogicinc.com
 Tune in to the Tastycast!!!!  http://dna.zeliepa.net

Offline [BTF]Sigma

  • Phenomenally Prodigious Member
  • **
  • Posts: 3059
    • View Profile
  • Rated:
Re: AS3 "bad" programming practices
« Reply #1 on: March 18, 2010, 07:48:25 AM »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

 

Yotematoi

July 09, 2026, 04:31:49 PM
DM no funca? Why?
 

yahoo

July 08, 2026, 03:01:46 PM
q2servers is down for some time
 

|iR|Focalor

July 04, 2026, 01:59:59 AM
 

Yotematoi

June 29, 2026, 03:58:05 PM
Today would have been X7's birthday, I still miss those long nights playing coop o dm.
 

Yotematoi

June 29, 2026, 03:56:26 PM
Hoy cumpliría años X7, sigo extrañando esas noches largas jugando en coop.

NovaReaper

May 22, 2026, 09:08:51 AM
Hello dears
 

-Unh0ly-

April 27, 2026, 03:50:00 PM

https://drive.google.com/file/d/159hj27IhNeZPBiw7_YTO7Gtt7DYXSW67/view?usp=drivesdk     New unholy quake 2 all new wrap models crosshair textures muzzle flash fer all guns it’s its own folder run q2repro.exe. Enjoy!!!
 

sawg

January 04, 2026, 02:00:11 PM
Can we ban these bots in DM and other servers that just spam bad jokes non-stop? I tried to join earlier and it took me 15 minutes to get in because there were about 10 of them connected

rikwad

December 26, 2025, 10:13:59 AM
Merry Christmas 🎄

What happened to Q2pro. Skuller fall out window?
 

|iR|Focalor

November 27, 2025, 09:53:14 AM

Show 50 latest
Welcome, Guest. Please login or register.
July 29, 2026, 08:38:01 PM

Login with username, password and session length