Signals: Think Outside the Event.
Signals are light-weight, strongly-typed AS3 messaging tools.
Wire your application with better APIs and less boilerplate than AS3 Events.
Signals are light-weight, strongly-typed AS3 messaging tools.
Wire your application with better APIs and less boilerplate than AS3 Events.
What is Generics?
Generics is essentially the ability to have type parameters on your type. They are also called parameterized types or parametric polymorphism.
A couple of PLUS points on Generics:
• Greater type safety.
• The net effect, especially in large programs, is improved readability and robustness.
What is Vector Class in ActionScript 3?
It is one of the new ActionScript features included in the Flash Player 10 Public Beta is the inclusion of a Vector class. Essentially, the Vector class is a typed Array, and in addition to ensuring your collection is type safe, can also provide (sometimes significant) performance improvements over using an Array.
The Vector class lets you access and manipulate a vector — an array whose elements all have the same data type.
Two primary benefits:
• Performance: array element access and iteration are much faster when using a Vector instance than when using an Array.
• Type safety: in strict mode the compiler can identify data type errors such as assigning a value of the incorrect data type to a Vector or expecting the wrong data type when reading a value from a Vector. Note, however, that when using the push() method or unshift() method to add values to a Vector, the arguments’ data types are not checked at compile time but are checked at run time.
For Example:
var a:Array = new Array();
//or
var b:Array = [];
Here is an example of instantiating a Vector that contains int types:
//var VARIABLENAME:Vector. = new Vector.();
var vector:Vector. = new Vector.();
Just as in an Array, you can initialize the Vector length to a specific size, by passing the length into the constructor:
Can I say:
If( Vectors in ActionScript 3 && Flash Player 10){
“Generics in ActionScript 3”
}else{
“Generics Not Found”
}
>What is Generics?
Generics is essentially the ability to have type parameters on your type. They are also called parameterized types or parametric polymorphism.
A couple of PLUS points on Generics:
• Greater type safety.
• The net effect, especially in large programs, is improved readability and robustness.
What is Vector Class in ActionScript 3?
It is one of the new ActionScript features included in the Flash Player 10 Public Beta is the inclusion of a Vector class. Essentially, the Vector class is a typed Array, and in addition to ensuring your collection is type safe, can also provide (sometimes significant) performance improvements over using an Array.
The Vector class lets you access and manipulate a vector — an array whose elements all have the same data type.
Two primary benefits:
• Performance: array element access and iteration are much faster when using a Vector instance than when using an Array.
• Type safety: in strict mode the compiler can identify data type errors such as assigning a value of the incorrect data type to a Vector or expecting the wrong data type when reading a value from a Vector. Note, however, that when using the push() method or unshift() method to add values to a Vector, the arguments’ data types are not checked at compile time but are checked at run time.
For Example:
var a:Array = new Array();
//or
var b:Array = [];
Here is an example of instantiating a Vector that contains int types:
//var VARIABLENAME:Vector. = new Vector.();
var vector:Vector. = new Vector.();
Just as in an Array, you can initialize the Vector length to a specific size, by passing the length into the constructor:
Can I say:
If( Vectors in ActionScript 3 && Flash Player 10){
“Generics in ActionScript 3”
}else{
“Generics Not Found”
}
1. The removal of on()/onClipEvent() from Flash CS3 makes creating simple interactivity hard.
2. Getting rid of loaded .swf files is hard.
3. Casting DisplayObject.parent makes controlling parent movie clips hard.
4. The removal of getURL() makes linking hard.
5. The removal of loadMovie() makes loading .swf files and images hard.
6. ActionScript 3.0′s additional errors make coding cumbersome.
7. Referring to library symbols dynamically is unintuitive.
8. Adding custom functionality to manually created text fields, to all movie clips, or to all buttons is cumbersome.
9. The removal of duplicateMovieClip() makes cloning a MovieClip instance (really) hard.
>1. The removal of on()/onClipEvent() from Flash CS3 makes creating simple interactivity hard.
2. Getting rid of loaded .swf files is hard.
3. Casting DisplayObject.parent makes controlling parent movie clips hard.
4. The removal of getURL() makes linking hard.
5. The removal of loadMovie() makes loading .swf files and images hard.
6. ActionScript 3.0′s additional errors make coding cumbersome.
7. Referring to library symbols dynamically is unintuitive.
8. Adding custom functionality to manually created text fields, to all movie clips, or to all buttons is cumbersome.
9. The removal of duplicateMovieClip() makes cloning a MovieClip instance (really) hard.
event-registration performance:
Very good Article by Mr.Colin Moock.
In Flash Player 9, the time required to register a listener for a given event increases as the number of listeners already registered for that event increases. Here are the results of a simple event-registration test on a P4-2.6ghz machine running Windows XP:
* Registering 1000 listeners for an event took .06ms per registration (i.e., an average of .06ms to run addEventListener() once).
* Registering 20000 listeners for the same event took .47ms per registration.
The increased per-listener registration time results from Flash Player 9′s implementation of a safeguard built into the event-registration system: when a listener asks to register for an event, ActionScript first checks whether that listener is already registered; if so, ActionScript rejects the registration request. Listeners are, thus, prevented from registering multiple times for the same event.
In Flash Player 9, the “already-registered” check uses a linear lookup, comparing the new listener to every existing listener before allowing the registration to proceed. If an event already has 20000 listeners, and a new listener asks to register, ActionScript must make 20000 comparisons before the registration can be allowed (hence the high “.47ms per-registration” cost in the test above).
Adobe has improved the situation in Flash Player 10 by using a hash-table lookup instead of a linear lookup when checking for the existence of listeners at registration time. Registering for an event with many existing registered listeners will, therefore, be much faster in Flash Player 10.
>event-registration performance:
Very good Article by Mr.Colin Moock.
In Flash Player 9, the time required to register a listener for a given event increases as the number of listeners already registered for that event increases. Here are the results of a simple event-registration test on a P4-2.6ghz machine running Windows XP:
* Registering 1000 listeners for an event took .06ms per registration (i.e., an average of .06ms to run addEventListener() once).
* Registering 20000 listeners for the same event took .47ms per registration.
The increased per-listener registration time results from Flash Player 9′s implementation of a safeguard built into the event-registration system: when a listener asks to register for an event, ActionScript first checks whether that listener is already registered; if so, ActionScript rejects the registration request. Listeners are, thus, prevented from registering multiple times for the same event.
In Flash Player 9, the “already-registered” check uses a linear lookup, comparing the new listener to every existing listener before allowing the registration to proceed. If an event already has 20000 listeners, and a new listener asks to register, ActionScript must make 20000 comparisons before the registration can be allowed (hence the high “.47ms per-registration” cost in the test above).
Adobe has improved the situation in Flash Player 10 by using a hash-table lookup instead of a linear lookup when checking for the existence of listeners at registration time. Registering for an event with many existing registered listeners will, therefore, be much faster in Flash Player 10.