Category 'Flash'
Finally with ActionScript 3.0 no longer have two different management of events as they did before ActionScript 2.0 (see: Event management: similarities between Flash and Javascript ). The method addEventListener() , ubiquitous in the new architecture allows to manage new and exceptionally clean all possible events, even personal ones. The new organization in the package allows you to import the events that we serve and treat everyone equally:
Continued ...
Flash CS3 has very many innovations, including the "curious" to indicate at the time of compiling some tips on writing code. This happens, for example, when we are dealing with objects TextField . I've had to add a string to the end of a field TextField with the classical notation:
1
| + = "Stringa aggiunta" ; mioTextField_txt. text + = "string adding"; |
But here is that ActionScript 3.0, when completing the movie, I felt (Warning) - or recommended:
Warning: 3551: Adding text to a TextField using + = is many times slower than using the TextField.appendText () method.
Cool! Let's see the fact of the method SYNOPSIS appendText() actually says:
) applicata a una proprietà text (ad esempio <strong>someTextField.text += moreText</strong> ), in particolare nel caso di un campo di testo con una quantità di contenuto significativa. Appends the string specified by newText at the end of the text field. This method is more efficient than an addition assignment ( += ) properties applied to a text (eg <strong>someTextField.text += moreText</strong> ), in particular in the case of a text field with a significant amount of content.
We trust? To verify security:
1 2 3 4 5 6 7 8 9
| . getTimer ; flash.utils imports. getTimer; uint = 0 ; var i: uint = 0; int = getTimer ( ) ; var s: int = getTimer (); i ; i < 10000 ; i ++ ) { for (i, i <10000; i + +) { + = "Ciao" ; text_txt. + text = "Hello"; } int = getTimer ( ) ; var f: int = getTimer (); f - s ) ; trace (f - s); |
Time: 9360 - on my machine in debug mode. Let's try as advised by the compiler:
1 2 3 4 5 6 7 8 9
| . getTimer ; flash.utils imports. getTimer; uint = 0 ; var i: uint = 0; int = getTimer ( ) ; var s: int = getTimer (); i ; i < 10000 ; i ++ ) { for (i, i <10000; i + +) { ( "Ciao" ) ; text_txt. appendText ("Hello"); } int = getTimer ( ) ; var f: int = getTimer (); f - s ) ; trace (f - s); |
Time: 8415 
Nothing fancy ... but it's true! ). The method appendText() is faster and more powerful pre-incremental operator ( += ). Why? The most obvious reason is as follows: the operator ( += ) works on any type of data. Moreover, in an OO language this operator is not structured as in C but is simply an "object". In C + +, for example, you can overwrite (override) the operator as part of the structure of the object language itself. Ultimately appendText() is faster because its goal is to "hang" a string and thus does not do many "questions" in it. The operator ( += ), however, should work for any type of data and therefore is not optimized for strings. In C, on the contrary, the operator ( += ) is a function of low-level and will always be faster than a call to a function.
Continued ...
ActionScript 3.0 introduces a number of formidable tools of communication, some totally new, some revised and improved from previous versions of ActionScript. We begin to see how it changes the way you interact with a Web Server in the case of a simple communication between Flash and a PHP page with the XML response. First of all, the object XML does not exist anymore! ActionScript 3.0 introduced new classes have been, some of which are dedicated to the "backward compatibility".
Note: The XML class (along with related classes) from ActionScript 2.0 have been renamed XMLDocument and moved to the flash.xml package. It is included in ActionScript 3.0 to ensure compatibility with previous versions.
usando il metodo sendAndLoad() dell'oggetto LoadVars (vedi: Flash: LoadVars e XML per inviare dati in POST ). In ActionScript 2.0 communication with a Web Server was often solved by using the combination of objects LoadVars and XML, using the method sendAndLoad() object LoadVars (see: Flash: LoadVars and XML to send data in POST ). Now things are changing, but you just get used to new names and objects. As indicated in the manual, in fact:
Continued ...
Because of its ability to communicate with the server, the XMLHttpRequest object (XHR), used in the technology Ajax (an acronym for Asynchronous JavaScript and XML, which should be pronounced "egiacs" although we prefer Italian "aiacs"), has a security lock that prevents you from running applications outside the domain in which it operates. This protection is necessary to prevent JavaScript Injection (techniques of "injection" extremely dangerous code in order to break the system) of various kinds, with the ultimate objective of "break" in the system.
This limit is now taken seriously and you're thinking, somehow, to solve it - directly into the XmlHttpRequest - without compromising security (see also: Third Proposal for cross-site extensions to XMLHttpRequest ).
Whatever the situation today is as follows:
Continued ...
Some readers have asked me how it was created the snowflake, so realistic, the Widget Christmas . Those who have downloaded the source you probably already know ... but it was really simple. First, I selected the Brush Tool in Flash and I drew a point.
I turned this into a symbol and I applied two effects in the right sequence: bevel and blur:
The result was: 
At this MovieClip (symbol) associated with a simple class I CNeve , which actually creates the intelligence of the staple itself:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| MovieClip { Cneve class extends MovieClip { _interval ; private var _interval; _maxy : Number ; _maxy private var: Number ; / / Cneve function () { this , "_move" , 25 ) ; _interval = setInterval (this, "_move", 25); round ( ( Stage . height + 256 ) / 2 ) + _getRndRange ( - 20 , - 7 ) ; _maxy = Math . round (( Stage . height + 256) / 2) + _getRndRange (- 20, - 7); } / / _getRndRange ( min : Number , max : Number ) : Number { private function _getRndRange (min: Number , max: Number ): Number { Number = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ; var randomNum: Number = Math . floor ( Math . random () * (max - min + 1)) + min; randomNum return; } / / _move ( ) { _move private function () { 1 , 5 ) ; _getRndRange _y + = (1, 5); _getRndRange ( - 50 , 50 ) ) > 0 ) ? 1 : - 1 ; _x + = ((_getRndRange (- 50, 50))> 0)? 1: - 1; 1 , 5 ) ; _getRndRange _rotation + = (1, 5); _y > _maxy ) { if (_y> _maxy) { _interval ) ; clearInterval (_interval); } ; updateAfterEvent (); } } |
The method _move() contains the intelligence of the staple, which is the function of a fall, extremely simple. By varying the random function _x += ((_getRndRange(-50, 50))>0) ? 1 : -1;, si può aggiungere un effetto effetto vento, cioè i fiocchi cadono con una pendenza particolare. _x += ((_getRndRange(-50, 50))>0) ? 1 : -1;, for example by inserting a _getRndRange(-550, 50), you can add an effect wind effect, that the flakes fall with a particular slope. In particular, the flakes can be sent to the right and left using a code like this:
1
| _getRndRange ( _getRndRange ( - 350 , - 50 ) , _getRndRange ( 50 , 350 ) ) ) > 0 ) ? 1 : - 1 ; _x + = ((_getRndRange (_getRndRange (- 350, - 50), _getRndRange (50, 350)))> 0)? 1: - 1; |
The rotation ( _rotation += _getRndRange(1, 5); ), this gives a further detail to the bow itself.
e uno scale randomico, per avere fiocchi di neve di diverse dimensioni. When I create a bow (see function creaFiocco() below) I also added an alpha=90 stairs and a random, to have snowflakes of different sizes.
1 2 3 4 5 6 7 8 9 10 11 12
| / / Create staple creaFiocco function () { 20 , 100 ) ; randRange var s = (20, 100); = randRange ( - Math . floor ( ( Stage . width - 320 ) / 2 ) , Math . round ( ( Stage . width + 320 ) / 2 ) ) ; randRange var x = (- Math . floor (( Stage . width - 320) / 2), Math . round (( Stage . width + 320) / 2)); = - Math . floor ( ( ( Stage . height - 256 ) / 2 ) ) - 10 ; var = y - Math . floor ((( Stage . height - 256) / 2)) - 10; "neve" , "neve_" + index , index , { _x : x , _y : y , _xscale : s , _yscale : s , _alpha : 90 } ) ; c_mc. attachMovie ("snow", "neve_" + index, index, {_x: x, _y: y, _xscale: s, _yscale: s, _alpha: 90}); index + +; index > 1000 ) { if (index> 1000) { ; index = 1; , 2 ) ; c_mc = createEmptyMovieClip ("c_mc", 2); } } |
And that's all ...
I forgot ... Happy holidays and best wishes to all ... 
Continued ...
Today I propose an interesting variant of the "classic" analog clock in Flash. This version contains a transition tween start of the movie. I was inspired to Gadgets in Windows Vista that does, in fact, this beautiful effect at startup.
The code is written in Actionscript 2.0 and has been compiled with the new Adobe Flash CS3. This demonstrates that the new CS3 suite is fully compatible with previous versions of Flash, an extremely important point for those who have decided to consider the product update.
For the source click here .
Continued ...
Thanks to "spurred" by TV Revolution I made a small Christmas Widgets (see if we can improve it with your comments).
To use simply insert the following code on your site:
The parameter h determines the height in pixels of the movie. By default, this is shown in absolute position and width to 100%. To change this setting used abs=0 to place the snow inside the page, not above. Instead, use w=800 to set a personal dimension. For example:
Create snow 50 pixels, 640 pixels wide, and relative position, as shown below:
Continued ...
For some developers just need to know that there is a new version of their preferred development package to run and buy the upgrade. Others, quite rightly, more calm and maintain a "pretend" to know the actual improvement in the new version before you change your habits. In the case of Adobe Flash CS3 is not much to wait, given the many changes that the package has undergone since Macromedia was acquired by Adobe.
Here, then, 10 simple, but important, reasons which, in my personal opinion, enough to convince you to upgrade to Adobe Flash CS3 . I will focus, of course, only on the things that struck me personally, this is not intended as an exhaustive list of all the many innovations introduced by the CS3 suite, only a fly to anticipate some features of CS3.
1. Installation
The installation is nice and fast, compared to previous versions. It includes, among other things, with all Adobe products (Dreamweaver CS3, Photoshop CS3 Extended, etc ...) which makes the installation / removal, and update a real pleasure.
2. Backward Compatibility
One issue often overlooked, but always taken into account in the history of Flash: The ability to manage previous versions of the product. In Flash CS3 has all the tools to manipulate it is to migrate the previous versions of our movies. We find this possibility in debugging (debugging a separate Actionscript 2.0 and Actionscript 3.0) is in the process of completing the movie. Write now Actionscript 3.0 Flash applications could be counterproductive in certain contexts. If your target site has a high traffic you may find that many users have not yet installed the latest versions of Flash Player for your browser and then would not see the movie. However, as noted above, Flash CS3 allows you to develop Flash applications mantendedo backward compatibility and therefore I do not see this as a big ostocalo nell'upgrade product.
3. GUI and IDE

The IDE Flash CS3 (like Dreamweaver CS3) has been revised to better. The panels (see picture left), often uncomfortable in previous versions, have been completely redesigned and now their use is much less invasive.
In addition, the ability to minimize panels (see figure at right) is found that makes a real attractive and functional interface. When a panel is in icon mode takes up much less space and with a simple click you can open the first main panel always visible.
All the IDE, in short, has been revised including the central area with the window for editing and graphic code. Do not you point out all the changes or you'll ruin the surprise ...

Continued ...
How can a disabled TextField input mode? Since the property enabled is not available you can use a simple artifice: change runtime state of the TextField. Fortunately, Flash developers are allowed to change the status of a TextField also run through the property type . It follows that if a TextField is added to the Stage as input (and hence type="input" ), by code, we can turn it into a text "static". In reality, the transform them into dynamic text ( type="dynamic" ) but the visual result is the same. The artifice works because both the TextField TextField input the dynamic properties share the same text . So if I put a text in a TextField input when it transformed into a dynamic TextField will have only the impression of not being able to insert characters! That I have disabled the TextField input!
The TextField object may also be extended as a MovieClip, then we may use the following code useful:
1 2 3
| prototype . Enabled = function ( v : Boolean ) { TextField . prototype. Enabled = function (v: Boolean ) { type = v ? "input" : "dynamic" ; this. v type =? "input": "dynamic"; }; |
Continued ...
di Flash. Illustrate a technique to create symbols (MovieClip) modal components to be used similarly to the Alert and Window of Flash. The aim is to show a MovieClip above all others, disabling - well - access to the underlying and any other object / component present. To be honest I have achieved that by doing a little 'reverse engineering code from Adobe, which is in the clear! I actually resisted 
The artefizio that is used to disable any interface present below our MovieClip, is to create a transparent MovieClip take the whole area of the stage. a false . At this MovieClip, which will be virtually no visible snaps a method "void" on the event onRelease , being careful to set the useHandCursor to false .
First of all we create a movie with any interface in the main stage:

Continued ...
Latest Comments
Robert : I rispsoto your questions with pleasure. The idea is really great. I am looking for a solution ...
Sting : @ Darius - you can see an example here: http://www.fight4fun.it/ clicking on: MAPS I hope ...
vik : Giustappunto I'm working on a project and the client asked me to show all the news (which are CPT) in ...
Giovambattista Fazioli : @ paso: absolutely. Simply identifying the field [cci] input [/ cci] you want to ...
paso : Hello I would like to request a service, you can use the datepicker with cform7 I spiegp best I can implement ...