Articles Tagged 'Actionscript 3.0'


Creating custom events in Actionscript 3.0

Creating custom events in ActionScript 3.0 is simple. Use them, then, allows you to use the method addEventListener() and make our object of all standards. ) BottoneEvent . If we created a class, eg Bottone , this is correct to associate with one or more events through a special class (derived from the class Event ) BottoneEvent . We could make all the events that affect the functioning of our subject: the click, mouse over, or any other event! Also defining our personal constant. The skeleton - generic - a class of custom event is:

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
package {
/ *
** @ Name: BottoneEvent.as
** @ Description: Class derived from Event to manage their own custom event
** @ Author: = undo =
@ ** Web: http://www.undolog.com
** @ Email: @ g.fazioli undolog.com
* /
.*; import flash.events. *;

BottoneEvent extends Event { BottoneEvent extends public class Event {

String = 'pluto' ; // codice qualsiasi, anche 'mioevento' in minuscolo public static const MIOEVENTO: String = 'bar', / / any code, even 'mioevento' in lower case

Valore : Number = NaN ; public var value: Number = NaN;
/ *
** @ Name: BottoneEvent
** @ Description: constructor
* /

type , bubbles , cancelable ) ; super (type, bubbles, cancelable);
Value = v ; this. Value = v;
}

/ *
@ ** Override
* /
clone ( ) : Event { public override function clone (): Event {
this . type , this . Value , this . bubbles , this . cancelable ) ; return new KnobEvent (this. type, this. Value, this. bubbles, this. cancelable);
}
}
}

More ...

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 expand the development with ActionScript 3. It includes support for MD5 and SHA 1, encoders for JPG and PNG, and JSON serialization for strings, numbers and dates APIs. Libreia This is very useful in the development of Flash applications and able to give it its best coupled with Adobe AIR!

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

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

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

More ...

Flash CS3: template for the document class

This is the template that I use for the document class of a generic project Flash CS3:

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
package {
/ *
** @ Name: MioDocumento.as
** @ Description: [description]
** @ Author: = undo =
@ ** Web: http://www.undolog.com
** @ Email: @ g.fazioli undolog.com - g (dot) Fazioli (at) undolog (dot) com
** @ Version: 1.0
* /

.*; import flash.display. *;
.*; import flash.events. *;

MioDocumento extends MovieClip { MioDocumento public class extends MovieClip {
/ *
Private ** @ var
* /

MainFive ( ) : void { public function MainFive (): void {
Event . ADDED_TO_STAGE , init ) ; addEventListener ( Event . ADDED_TO_STAGE, init);
}

/ *
** @ Name: init ()
** @ Description: When trigged added to the Stage
* /
init ( e : Event ) : void { protected function init (e: Event ): void {
/ / Todo
}
} / / Constructor
} / / Package

More ...

PicLens 2.0 in Flash with Papervision3D

PicLens You can achieve the effect of the add-on PicLens Firefox in Flash? I think so! With Papervision3D can come very close to the same effect. This I present a prototype of which I can not - for now - make available the code. However it is interesting to note that the effect is likely. The image you see repeated 100 times is encapsulated within the SWF movie and its dimensions are 256 × 256 (24bit Transparent PNG). Alternatively, it is very easy to read a list of images from an XML file, which I have already done in another demo. In this prototype I used Adobe Flash CS3, Actionscript 3.0 and 2.0 version of Papervision3D (GreatWhite).

Flash Player Loading ...

More ...

Namespace read parameters from an XML file in Actionscript 3.0

Imagine you have an XML file that at some point contains the following line:

1
2
...
type = "image/jpeg" /> <media :thumbnail url = "thumbs/pic10.jpg" type = "image/jpeg" />

As I read, for example, the url attribute in Actionscript 3.0?

If the XML was this:

1
2
...
type = "image/jpeg" /> <Image url = "thumbs/pic10.jpg" type = "image/jpeg" />

) sarebbe stato sufficiente: After obtaining the pointer to &lt;immagine/&gt; ( imgptr ) would be sufficient:

1
imgptr . @ url ) ; trace (imgptr. @ url);

If &lt;media:thumbnail/&gt; , however, add:

1
2
Namespace = myXML . namespace ( "media" ) var mediaNS: Namespace = myXML. namespace ("media")
myXML . mediaNS :: thumbnail . @ url ) ; trace (myXML. mediaNS :: thumbnail. @ url);

More ...

Actionscript 3.0: Simulate the event onReleaseOutside

With Flash CS3 and Actionscript 3.0 has been revised many things including the presence of the event onReleaseOutside . The latter, as many other cosine, has been eliminated without a real reason and without a real alternative. In the official documentation Actiobscript 3.0, in the section Migrating from ActionScript 2.0, looking for onReleaseOutside is indicated:

More ...

Installing Papervision3D 2.0 Great White: TortoiseSVN

It was a long time that I followed the project Papervision3D , a library in Actionscript (2.0 and now 3.0) for manipulating 3D objects and render truly spectacular. Inaugurated, so the category Papervision3D (soon also 3D), inserted in Flash CS3 . Papervision3D is also available for Actionscript 2.0, although I personally treat only the version for Actionscript 3.0.

More ...



Stop SOPA