Converts AS2 to 3 from dreamsocket: I'm studying it to learn from other devs.