Archive December, 2007


Happy Holidays to all! No one excluded

Merry Christmas and Happy 2008

This year is a Christmas special, as it is the first from the father of two wonderful (and exhausting) twins!

Lorenzo and Sabrina

More ...

Letter to Santa Adobe: Flash CS3, a few bugs and defect

Dear Santa Adobe,
despite having already received two patches for Flash CS3 (version 9.0.2), some troubles in its use have appeared as in all software in the world, especially in this release that the changes it has undergone very many.

  • L 'ActionScript editor, for example, is slow and jerky! Consider, Adobe dear Santa, that my car has 8Gbyte of RAM and an Intel quad core duo!
  • During the automatic formatting, lines of code like this below, are "misunderstood" and reformatted evil:
1
( MouseEvent . CLICK , function ( e ) { myfunc ( ) ; } ) ; mybtn. addEventListener ( MouseEvent . CLICK, function (e) {myfunc ();});

Adding braces where it should be:

1
2
( MouseEvent . CLICK , function ( e ) { myfunc ( ) ; } ) ; mybtn. addEventListener ( MouseEvent . CLICK, function (e) {myfunc ();});
// < -- chi te l'ha detto?! } / / <- Who told you?!

So better use the syntax:

1
( MouseEvent . CLICK , _onClick ) ; conn_btn. addEventListener ( MouseEvent . CLICK, _onClick);
  • The windows docket, at least in the implementation of Windows Vista, occasionally disappearing beneath other panels ... The Help window, the guidance in short, creates a problem when you try a project. The latter, in fact, disappears behind the other panels ... mystery! However, this defect, like others, is not always reproducible.
  • The components have strange behavior: sometimes are shown, in design-time, as white rectangles ... but continue to operate at runtime!
    Missing Components
  • The 'anterprima scale9Grid, as indicated in the new documentation and be able to show the objects correctly resized at design-time, continues to be plagued by the problems of the previous version! Too bad!
    Scale9Grid

However at Christmas is all better ... so, dear Santa Adobe, we look forward future updates.

More ...

FreeTextBox: Javascript HTML WYSIWYG editor for ASP.NET

image FreeTextBox is an HTML editor written in JavaScript, for ASP.NET. This version, the 4.0 Beta 1 is compatible with IE, Mozilla and Firefox on all platforms. Like other editors (see: WYSIWYG Editor for the Web ) allows you to set its appearance and instruments. Although for ASP.NET, framework by me untouched, I report for its pleasantness. However, sin, comes in two versions: a free and a fee!

image

More ...

Flash CS3: The new event handling

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:

1
2
3
4
/ / Events
. KeyboardEvent ; import flash.events. KeyboardEvent ;
. MouseEvent ; import flash.events. MouseEvent ;
. Event ; import flash.events. Event ;

More ...

Flash CS3: TextField.appendText ()

Flash CS3 has so many innovations, including the "odd" to specify at compile 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 that's ActionScript 3.0, when completing the movie, I felt (Warning) - or recommended:

Warning: 3551: Appending text to a TextField using + = is many times slower than using the method TextField.appendText ().

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. Adds 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 ; import flash.utils. 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 us try as advised by the compiler:

1
2
3
4
5
6
7
8
9
. getTimer ; import flash.utils. 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 great ... but it's true! ). The method appendText() is faster and more powerful pre-incremental operator ( += ). Why? The most obvious reason is the following: the operator ( += ) works on any type of data. Besides, in an OO language this operator is not structured as in C but is simply "oggettato". 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 "fix" to a string and thus does not do many "questions" in it. The operator ( += ), however, must work for any type of data and therefore is not optimized for the strings. In C, on the contrary, the operator ( += ) is a function at a low level and will always be faster than a call to a function.

More ...

Flash CS3: communicating with a Web Server

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 a response XML. First of all, the object XML does not exist anymore! In ActionScript 3.0 new classes were introduced, some of which are dedicated to "backward compatibility".

Note: The XML class (along with related classes) from ActionScript 2.0 have been renamed XMLDocument and moved to the package flash.xml. 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 resolved by exploiting 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:

More ...

Greeting

Commodore 64

It all started from here ... greetings to my first personal computer, as it was advertised at the time that although it's now technically outdated, will always remain unsurpassed in soul and memory of many!

More ...

Tunneling and proxy servers, and not only for Ajax

Because of its ability to communicate with the server, the object XmlHttpRequest (XHR), used in the technology Ajax (which stands for Asynchronous JavaScript and XML, which should be pronounced "egiacs" even if we Italians prefer "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 into serious consideration and you're thinking, somehow, to solve it - XmlHttpRequest object directly - without compromising security (see also: Third Proposal for cross-site extensions to XMLHttpRequest ).

However, the situation today is as follows:

XHR

More ...

The new site Adobe.it

Adobe.it

The site Adobe.it is renewed, it is of erasing the hybrid Adobe-Macromedia made ​​immediately after the acquisition of software company of Flash! Pagination original file (at left end), use of DHTML and Flash, of course.

image Photoshop

All sections have been redesigned with an original use of the background. From rinavigare absolutely !

More ...

Create a snowflake in Flash

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.

SnowflakeSnowflake

I turned this into a symbol and I applied two effects in the right sequence: bevel and blur:

SnowflakeSnowflake

The result was: Snowflake

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 ; private var _maxy: 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 ) ; _y + = _getRndRange (1, 5);
_getRndRange ( - 50 , 50 ) ) > 0 ) ? 1 : - 1 ; _x + = ((_getRndRange (- 50, 50))> 0)? 1: - 1;
1 , 5 ) ; _rotation + = _getRndRange (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))&gt;0) ? 1 : -1;, si può aggiungere un effetto effetto vento, cioè i fiocchi cadono con una pendenza particolare. _x += ((_getRndRange(-50, 50))&gt;0) ? 1 : -1;, for example by inserting a _getRndRange(-550, 50), you can add an effect wind effect, ie the flakes fall with a particular slope. In particular, it can send the flakes left and right using a code of this type:

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); ), then, gives a further detail to the staple 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 and a randomico stairs, to have snowflakes of different sizes.

1
2
3
4
5
6
7
8
9
10
11
12
/ / Create staple
creaFiocco function () {
20 , 100 ) ; var s = randRange (20, 100);
= randRange ( - Math . floor ( ( Stage . width - 320 ) / 2 ) , Math . round ( ( Stage . width + 320 ) / 2 ) ) ; var x = randRange (- 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 ... Best wishes to all and Happy Holidays ... ;)

More ...



Stop SOPA