Category 'Tutorials'


Google AJAX Language API tutorial on the operation

I respond with this post, at the request of Andrea on how to insert the translator of Google in your web. There are several ways to take advantage of machine translation services available from Google and beyond. We can use plugins written by others, a simple JavaScript script from Google itself or mixed learning to use the API, ie a set of callable functions - as we shall see - in various ways.

Plugins

I will not dwell on this solution, as I think is not really relevant to the request of Andrew , if I understood well. Furthermore, it is essentially a solution valid only for the blog and not to use custom and generic. I can only point out to users by WordPress , Global Translator , perhaps the most simple, practical and popular plugins of this type.

Pre script by Google

The easiest way to translate your website or your blog is to add a simple JavaScript script provided by Google. Just go to the site translate.google.com tab and click on 'Tools'. From this page you can preset the translation functions or leave the default. The script is very simple:

1

and as a result we obtain:

Google Translate

Continued ...

AS3Corelib: library for MD5, SHA1 and JPG / PNG Encoder

AS3corelib project is a library written in ActionScript 3, which contains a series of classes and utilities to extend the development with ActionScript 3. Support is included for MD5 and SHA 1, encoders for JPG and PNG, and JSON serialization for strings, numbers and dates APIs. This libreia is very useful in the development of Flash applications and able to give it their best in tandem with Adobe AIR!

Of the various packages present the most interesting and com.adobe.crypto com.adobe.images. The first allows you to handle MD5, SHA1, SHA224 and SHA256, so very simple: the method using hash() is passed the string and returns the source-code! The package even allows images to get the encoder JPG or PNG bitmap from a simple Flash!

1
encode ( image : BitmapData ) : ByteArray public function encode (image: BitmapData ): ByteArray

The result ByteArray representing the encoding to JPG, Flash, permitting, can be saved directly to disk! To learn more you can follow this video tutorial on how to save a PNG image - from a video object - on disc by as3corelib .

Continued ...

How to save images in Flash CS3

With the use of Adobe Flash CS3 Bitmap is so improved that is immediately wanted to create a small Paint. . We have already seen how to make a small Paint (see Paint in Flash CS3 Create a Painter: simple application for drawing in Flash CS3 Pro ) can support a true "eraser" - erase function, thanks to a particular use of Layer Shape and Bitmap . Let's say that Flash (as opposed to Flex) it does not allow encoding (such as JPG or PNG) it automatically saves the Bitmap images. However you can get around it using a server-side scripting and the ability to send data in POST Flash.

Continued ...

Flash CS3 to create fog effect TV in 1 second

Flash CS3 does not ceases to amaze. Here's how to create the classic fog of televisions in a second with 10 lines of code.

Loading Flash ...

Continued ...

Photoshop tutorial: folded paper effect

image Adobe Photoshop is a powerful tool and allows you to create truly captivating effects. To achieve the effect of bending of a sheet of paper, in fact, we can use the transform tool to "bend" - really - a layer. With a few small steps can make the effect very realistic. The images presented below in this tutorial are examples and are made in low resolution. To improve the effect of using a high resolution, so you want to resize the image to the end and get an anti-aliasing on the edges.

Continued ...

Photoshop Tutorial: Web 2.0 style icons in 3 steps

image This Photoshop tutorial shows how it is "relatively" easy to create eye-catching icons for web 2.0 style with reflections and so on, simply by setting the effects on the layer. Once you understand the process, it is also possible - giving free rein to your creativity - to create many variations.

Continued ...

Photoshop tutorial: planet with rising sun

image

STEP 1

Create an image of at least 800 × 600 pixels. Add a layer (bck) - that is our background - and draw space. It must be a dark picture! You can enjoy you realize it or place (as I did) some spectacular images from NASA, by adjusting the levels so that it is still dark. From the Filter menu, select Render / Lens Flare - we create our sun! You can do this "rise" where you want ... I have placed in the middle to the top of the image:

image

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 ...

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 ...