A few ActionScript 3.0 quetsions...


macrumors 65816
Original poster
Jan 5, 2002
Please forgive me if these are dumb questions :rolleyes: but I have yet to find clear concise answers. My current experience: I feel very confident with AS1, never bothered with AS2 and am currently learning AS3. I have the fundamentals down but there are a few things that are frustrating me....

1. Data types: Number, int and unit. I have seen the three used in example files but am confused as to when and or why to use anything but Number. Moock keeps switching but never explains as to why.

My understanding:
Number—can represent both int or unit
int—whole numbers only
unit—no clue

2. I keep seeing examples that deviate from the specification, specifically when declaring the event type.


function onClick(event:MouseEvent):void {
//do something

I have seen the event type abbreviated as evt and even simply as e. The only explanation that I have found so far is it is developer preference. Yet Flash only recognizes—changes to blue—the term event. In most of the examples that I have seen—ranging from Moock Colin's book to Foundation Flash CS3 and lynda.com's Professional Training—there is no explanation as to why they are substituting. Why is this allowed as I see it confusing for beginners to AS3 like myself.

3. Continuing with the function question: when dealing with constructor functions vs. typical functions. Why does the constructor function not receive a return type? A typical function is always given a return type—I have seen a few examples where even normal functions lack the return type. Why is a constructor function different?

Thank you to anyone who might be able to clarify any of the above questions.


I will also seek help on a few Flash forums but generally I find this community to be more responsive.


macrumors 6502a
Nov 29, 2005
a simulacrum
right, one at a time(from what i know,if someone else knows better please correct me):

1. just go with Number, no real need to confuse yourself with the other ones
2. the event in the function is a variable for that function, so you can give it any name you want, it's just common practice to use event or evt or e. it's a variable that is cast to the datatype that the function will receive when it's called, and internal to that function, that's all.
3.a constructor doesn't need a return type cause it's not a normal function, it's a constructor, which means that it gets called when the object is actually instantiated, it does what you tell it to and that's it.
you might wanna do some reading on object oriented programming(boring as hell,i know) to help you get to grips with actionscript

hope this helps and i got it right :D


macrumors 65816
Original poster
Jan 5, 2002
hope this helps and i got it right :D
1. I like your answer to question 1 regarding Number, int, uint. I will just stick with Number. I just wish that the books would be a bit clearer.. you think that in 900+ pages Moock could have added in a "oh, by the way..." One book I read just stayed with Numbers but then another—which was targeted towards designers—tossed in the int without any explanation.

2. I was thinking the same thing regarding the use of evt, e or event. I think I just needed to hear someone actually say it.

3. I will definitely read more up on OOP, at least I feel that I have the basic concept down. Moock gets into a bit with his Essential AS3 book but I found that his examples to be bit confusing as he doesn't explain them well.

Very helpful, thanks! :)

Don't let this shy away any other opinions, would love to hear them... specifically any other views on question 1.


macrumors 601
Jul 18, 2002
regarding Number/uint/int, you can use uint if the values you're representing are positive integers (e.g. a person's age). if negative integers are allowed, use int.

you'll need Number for float values.

regarding e vs evt vs event, as a local variable you can call it whatever you want. "gleet" for example. BUT, and this is not an AS3 issue so much as a general programming one, descriptive variable names are always nice. in this instance, i use "event".

regarding the ctor, sk3pt1c got it, but further i'd like to know if *any* class-based language allows a return type from its constructor.