What asterix ("*") means in the variable declaration ?
For example:
var _loc_2:* = Number(this.text_control.text);
Why this is not:
var _loc_2:Number = Number(this.text_control.text); ?
For example:
var _loc_2:* = Number(this.text_control.text);
Why this is not:
var _loc_2:Number = Number(this.text_control.text); ?
What kglad said is most likely true, but the general use of asterisk is to be a wildcard, so that any variable type can come in. You can make an argument that it's sloppy programming, or that at least you're not doing as much as you could to show up compiler errors. But here's one example:
Suppose you want to let the user skip the loading of something, but if they don't skip things will proceed once the item is loaded. You might have something like this:
loader.addEventListener(Event.COMPLETE,proceed);
skipBtn.addEventListener(MouseEvent.CLICK,proceed);
One of those is a mouse event the other is just an event. In this case you could have:
function proceed(e:Event){
//go on to next thing
}
because MouseEvent is still Event. The other way to solve it would be:
function proceed(e:*){
//go on to next thing
}
As I said, this isn't necessarily a good way to work, but you have the option of doing it that way.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.