Category 'Flash'


Unobtrusive SWFObject 2.0

SWFObject SWFObject is a JavaScript script is used to insert Flash content in Web pages Its main function is to eliminate the request to activate the control by the Microsoft Internet Explorer (which, by the way, is being discontinued - see here ) and, more interestingly, the ability to automatically check and install Flash Player if required. SWFObject can be considered a good alternative to the kit to install / detect supplied by the same Adobe Flash is generated inside the IDE (in all its versions). With version 2.0 , SWFObject improves its performance and its use. As stated on official documentation , moved to Google Code, new in this release are so many as to make it NOT compatible with previous versions. This results in virtually a complete overhaul of the code for those who decide to upgrade a previous version of SWFObject 2.0.

The script is now aligned to the latest standards, both from the syntactic point of view that "non-intrusive." It supports all previous features such as quick installation of the Flash Player, with a code more clear and easy to use. The change of parameters, for example, JavaScript to Flash Player (and therefore to our movie) is now much lighter and versatile. Also introduced were two main modes: static and dynamic, depending on the type and page design process that we are doing.

Bon and really liked it because it is the online tool that generates code for SWFObject us.

LINK:

Continued ...

Adobe AIR FAQ: Everything You Need to Know

By turning on various blog (thanks Frank) and through discussions with Julius , I realized that, in addition to the extreme interest in Adobe AIR , there is also much confusion, and rightly so. Both developers and users continue to not be clear what it is, what you serve and how developments in Adobe AIR . I decided, therefore, to gather the various threads in this sort of FAQ to try to clear a little 'what is actually hiding behind Adobe AIR.

Continued ...

Everything you ever wanted to do with Actionscript 3

A great innovation introduced with Actionscript 3.0 is to be able to list all objects (including shape drawn at the time) present in a container ( DisplayObjectContainer ). In fact it was now that Adobe introduced this feature. I had always complained about this lack, especially since going to debug the Flash environment was able to carry it out quietly but remained completely inaccessible from code!

Continued ...

Flash CS3 Professional: unformatted code

I guess I wonder why Adobe with a list of bugs growing!?. The bug I found, in CS3 Professional in Italian, is very annoying and dangerous. Eye to the following code:

1
2
3
getRandRange ( min : uint , max : uint ) : uint { private function getRandRange (min: uint , max: uint ): uint {
uint ( Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ) ) ; return ( uint ( Math . floor ( Math . random () * (max - min + 1)) + min));
}

After the automatic formatting:

1
2
3
getRandRange ( min : uint , max : uint ) : uint { private function getRandRange (min: uint , max: uint ): uint {
( Math . floor ( Math . random ( ) * max - min + 1 ) + min ) ; return uint ( Math . floor ( Math . random () * max - min + 1) + min);
}

He removed the brackets in the calculation of max-min+1 ! Which, of course, no longer returns the correct value! . The bracket, in fact, is vital as it allows to multiply Math.random() for the entire result of the (max-min+1) . e poi, al risultato di questa moltiplicazione, viene sottratto (min+1) !! In the second case, after the code was "sformattato", Math.random() is multiplied by "only" to the max and then, the result of this multiplication is subtracted (min+1) ! I explained only for the sake of completeness ... but I think it was clear to everyone ...

Obviously at home Adobe really think that mathematics is an opinion!?
This is a bug of dangerous ... if the formatting codes bodied "upsets" the code, it becomes a serious problem going to put everything back in place! I hope that Adobe may provide a patch as soon as possible! So WARNING! Let me know if it does to you, to your version ...

Continued ...

UMAP Flash Component (Beta v0.6)

image

She was released the beta 0.6 component UMAP for Flash CS3 (Actionscript 3.0) - is also present in the package version for Flex. Among the news we see the adoption of OpenStreetMap as the default provider. Also added was an advanced manager Marker and a series of various optimizations.

Continued ...

Adobe AIR 1.0, Adobe Flex 3.0 and the new Adobe Open Source

Adobe AIR Great news for AIR developers. It was finally released version 1.0 ! End of beta then! New SDK (vital for building in areas such as Aptana Studio , Eclipse , etc ...) and update extensions Dreamweawer and Flash CS3 Professional in Italian ! Until yesterday, in fact, it was not possible to develop an AIR application with Flash CS3 Profession in Italian. Now the new menu for creating RIA AIR is available and working! You can find all the updates (security fixes and extensions) directly on the site.

Adobe Open Source Another novelty is the official launch of Adobe Open Source , a new website that will track all the latest in open source, not just Adobe. This becomes, then, the point of reference for developers that will entice contributions with interesting demos, source code and more, such as support for open source projects Tamarin and BlazeDS .

Soon we will see how to develop a simple AIR application with Flash and Dreamweaver!

Continued ...

Painter: simple application for drawing in Flash Pro CS3

Here is a demonstration of how easy it is developing applications in Flash CS3. After several discussions on the development of an "erase", I propose a simple application that implements fully some of the things said in previous posts. In this example I added a ToolBar "draggabile", the ability to choose the color of the brush and the background, the selection of the instrument "erase" and a slight "blur" during the design!

Loading Flash ...

Download the source code for Adobe Flash CS3 Professional

Continued ...

Flash CS3: A text bug

Working with static text cuorioso I discovered a flaw in Adobe Flash CS3 Professional . By placing static text in a movie and an angle (skew), different results are obtained when it runs the movie, based on the anti-aliasing:

Flash CS3 bug text

Flash authoring environment, however, the preview is the same for both choices of anti-aliasing. In the example shown above I used a Font Arial. However, the problem occurs with any source, even those bitmaps. The same defect occurs by entering static text within a MovieClip and tilting it instead of the actual text. (?)

Continued ...

Painting Flash CS3: real time erase tool

Starting with the codes provided in Flash CS3 Create a Paint , and performing minor modifications, can greatly improve the instrument of "erase". Adding a Shape is not visible, you can use it as a "plan" to run the draw() blend mode "erase". As shown in the example below, after drawing something, hold down the Ctrl key and the effect of "cancellation" is now in real time.

Loading Flash ...

The code is as follows - Source :

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
. MouseEvent ; import flash.events. MouseEvent ;
. BitmapData ; import flash.display. BitmapData ;
. Bitmap ; import flash.display. Bitmaps ;
. GradientType ; import flash.display. GradientType ;
/ /
. Matrix ; flash.geom imports. Matrix ;
/ /
Boolean = false ; md var: Boolean = false;
/ /
Sprite = new Sprite ( ) ; var event_spr: Sprite = new Sprite ();
event_spr ) ; addChild (event_spr);
/ /
Number = event_spr . stage . stageWidth ; var area_width: Number = event_spr. internships. stageWidth;
Number = event_spr . stage . stageHeight - 32 ; var area_height: Number = event_spr. internships. stageHeight - 32;
/ /
String = GradientType . LINEAR ; fillType var: String = GradientType . LINEAR;
: Array = [ 0xFF0000 , 0x00FF00 , 0x0000ff ] ; var colors: Array = [0xFF0000, 0x00FF00, 0x0000FF];
: Array = [ 1 , 1 , 1 ] ; var alphas: Array = [1, 1, 1];
: Array = [ 0 , 128 , 255 ] ; var ratios: Array = [0, 128, 255];
String = SpreadMethod . PAD ; spreadMethod var: String = SpreadMethod . PAD;
: Matrix = new Matrix ( ) ; var matrix: Matrix = new Matrix ();
createGradientBox ( area_width , area_height , 1 , 0 , 0 ) ; matrix. createGradientBox (area_width, area_height, 1, 0, 0);
/ /
event_spr . graphics ) { with (event_spr. graphics) {
fillType , colors , alphas , ratios , matrix , spreadMethod ) ; beginGradientFill (fillType, colors, alphas, ratios, matrix, spreadMethod);
0 , 0 , area_width , area_height ) ; drawRect (0, 0, area_width, area_height);
; endFill ();
}
/ / Paint event
( MouseEvent . MOUSE_DOWN , _onMouseDown ) ; event_spr. addEventListener ( MouseEvent . MOUSE_DOWN, _onMouseDown);
( MouseEvent . MOUSE_MOVE , _onMouseMove ) ; event_spr. addEventListener ( MouseEvent . MOUSE_MOVE, _onMouseMove);
( MouseEvent . MOUSE_UP , _onMouseUp ) ; event_spr. addEventListener ( MouseEvent . MOUSE_UP, _onMouseUp);
( MouseEvent . MOUSE_OUT , _onMouseUp ) ; event_spr. addEventListener ( MouseEvent . MOUSE_OUT, _onMouseUp);
/ /
BitmapData = new BitmapData ( event_spr . width , event_spr . height , true , 0 ) ; var bmpd: BitmapData = new BitmapData (event_spr. width, event_spr. height, true, 0);
Bitmap = new Bitmap ( bmpd ) ; var bmp: Bitmap = new Bitmap (bmpd);
bmp ) ; addChild (bmp);
/ /
/ / Temporary shape
Shape = new Shape ( ) ; var draw_shape: Shape = new Shape ();
draw_shape ) ; addChild (draw_shape);
/ /
/ / Shape is not visible, used for the "cancellation"
Shape = new Shape ( ) ; var erase_shape: Shape = new Shape ();

/ /
e : MouseEvent ) : void { _onMouseDown function (e: MouseEvent ): void {
) ; debug ("_onMouseDown");
. lineStyle ( 10 , 0xffffff , 1 ) ; draw_shape. graphics. lineStyle (10, 0xffffff, 1);
. lineStyle ( 20 , 0xffffff , 1 ) ; erase_shape. graphics. lineStyle (20, 0xffffff, 1);
. moveTo ( e . localX , e . localY ) ; draw_shape. graphics. moveTo (and. localX, and. localY);
. moveTo ( e . localX , e . localY ) ; erase_shape. graphics. moveTo (and. localX, and. localY);
md = true;
}
/ /
e : MouseEvent ) : void { _onMouseUp function (e: MouseEvent ): void {
md = false;
. draw ( draw_shape ) ; bmp. bitmapData. draw (draw_shape);
. clear ( ) ; draw_shape. graphics. clear ();
. clear ( ) ; erase_shape. graphics. clear ();
}
/ /
e : MouseEvent ) : void { _onMouseMove function (e: MouseEvent ): void {
) ; debug ("_onMouseMove");
md && ! e . ctrlKey ) { if (md & &! and. ctrlKey) {
. lineTo ( e . localX , e . localY ) ; draw_shape. graphics. lineTo (and. localX, and. localY);
( md && e . ctrlKey ) { } Else if (md & & and. CtrlKey) {
. lineTo ( e . localX , e . localY ) ; erase_shape. graphics. lineTo (and. localX, and. localY);
. draw ( erase_shape , null , null , "erase" ) ; bmp. bitmapData. draw (erase_shape, null, null, "erase");
}
}
/ /
v : String ) : void { function debug (v: String ): void {
: Date = new Date ( ) ; var d: Date = new Date ();
d . getMinutes ( ) + ":" + d . getSeconds ( ) + ":" + d . getMilliseconds ( ) + ": " + v ) ; trace (d. getMinutes () + "" + d. getSeconds () + "" + d. getMilliseconds () + "" + st);
}

): We have added a new Shape, erase_shape not visible (it was not carried out any addChild() ):

1
2
3
...
/ / Shape is not visible, used for the "cancellation"
Shape = new Shape ( ) ; var erase_shape: Shape = new Shape ();

The piece of code that takes care of drawing has been introduced for the control key and, if pressed, is interested precisely the Shape erase_shape and copied to the Bitmap:

1
2
3
....
. lineTo ( e . localX , e . localY ) ; erase_shape. graphics. lineTo (and. localX, and. localY);
. draw ( erase_shape , null , null , "erase" ) ; bmp. bitmapData. draw (erase_shape, null, null, "erase");

Continued ...

Paint to create an application in Flash CS3

As explained in Flash Actionscript contest: erase tool you can not "erase" a particular area of a Sprite, MovieClip, or Shape on which lines or rectangles were drawn using the graphics cursor. There is, in fact, the only method clear() , however, has no effect on the entire area of the object. The solution to this problem lies in the possibility of using the Bitmap and BitmapData objects. As we shall see we can directly access and manipulate bitmap data in order to "erase" strokes with a real instrument "eraser".

Present two different methods to achieve the "gate". per esempio. The first "draw" (delete) data directly into the BitmapData, using the method fillRect() - can also be used setPixel() for example. The second method, the one I prefer, uses the methods of mergers (blendMode).

First of all let's see what kind of organization is minimally necessary to achieve a simple Flash Painter. The scheme presented below applies to both the proposals of the "gate":

bitmap pattern-

I created three layers: the first, MovieClip or Sprite, background and work the event handler (MouseDown, MouseMove and MouseUp). The second, the Bitmap is our main layers, one that will actually drawn graphics will be applied and on which the "gate". , ecc…). The third and last layer, the Shape, addresses two issues: the first is that it allows to directly use the functions provided by the graphics cursor (like lineStyle , drawRect() , etc ...). It also increases the performance during the tracking chart, as explained in detail below.

Continued ...