MagicLetter Flash Class: A class for writing magical

As promised here is the updated version of the sympathetic effect of written magic. I made a different animation for the "letter", to show how many effects you can do. The complete source you can download it here .

Loading Flash ...

Class MagicLetter

This is the code of the class, of course, can be further modified and improved. For example, you can enter a parse supprot for a symbol of "new line", to wrap words. Can be introduced functions get and set some properties to export outside, and more.

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
/ *
**
** File: MagicLetter.as
** Version: 1.0
** Author: Giovambattista Fazioli (@ g.fazioli undolog.com)
** Web: http://www.undolog.com
** Email: g (dot) Fazioli (at) undolog (dot) (com)
** Created: 10/21/2007 13:57
** Modified: 22/10/2007 22:02
**
** Based on a "linkage" MovieClip create text animation
**
* /
{class MagicLetter
__release : String = "1.0" ; __release private var: String = "1.0";
/ /
__mc : MovieClip ; private var __mc: MovieClip ;
__text : String = "" ; __text private var: String = "";
__timeout : Number = 50 ; __timeout private var: Number = 50;
__interval ; private var __interval;
__index : Number = 0 ; __index private var: Number = 0;
__linkage : String = "magicletter" ; __linkage private var: String = "magicletter";
__x : Number = 0 ; private var __x: Number = 0;
__y : Number = 0 ; __y private var: Number = 0;
/************************************************* *******************************************
** Manufacturer
**
** Do not ask the MovieClip class by inheriting a pointer to a MovieClip (eg _root)
** During the construction of the object
************************************************** ******************************************/
mc : MovieClip , n : String , d : Number ) { MagicLetter function (mc: MovieClip , n: String , d: Number ) {
"MagicLetter::contructor" ) ; trace ("MagicLetter:: contructor");
n , d ) ; __mc = mc. createEmptyMovieClip (n, d);
}
/************************************************* *******************************************
** Show () - triggers the display of the animation
**
** To - TimeOut
** X - x-coordinate
** Y - y-coordinate
************************************************** ******************************************/
Show ( str : String , to : Number , x : Number , y : Number ) { public function Show (str: String , to: Number , x: Number , y: Number ) {
/ / If non-null string! = ""
str . length > 0 ) { if (str. length> 0) {
__timeout = to;
__x = x;
__y = y;
__text = str;
__index = 0;
this , "__createMagicLetter" , __timeout ) ; __interval = setInterval (this, "__createMagicLetter" __timeout);
}
}
/************************************************* *******************************************
** __createMagicLetter () - Method is called by setInterval () that adds an animation
************************************************** ******************************************/
__createMagicLetter ( ) { __createMagicLetter private function () {
attachMovie ( __linkage , "item" + __index , ( __index + 1 ) , { _x : __x , _y : __y } ) ; var = t_mc __mc. attachMovie (__linkage, "item" + __index (__index + 1), {_x: __x, _y: __y});
TextField = t_mc . shadow_mc . letter_txt ; var s_txt: TextField = t_mc. shadow_mc. letter_txt;
TextField = t_mc . letter_mc . letter_txt ; var n_txt: TextField = t_mc. letter_mc. letter_txt;
= s_txt . autoSize = true ; n_txt. autoSize = s_txt. AutoSize = true;
= s_txt . text = __text . substr ( __index , 1 ) ; n_txt. text = s_txt. __text = text. substr (__index, 1);
textWidth ; + = __x n_txt. textWidth;
__index + +;
__index > ( __text . length - 1 ) ) { if (__index> (__text. length - 1)) {
__interval ) ; clearInterval (__interval);
}
; updateAfterEvent ();
}
}

Example of how to use the Class

This code can be located on the first frame of the movie:

1
2
3
4
5
6
MagicLetter imports;
/ / MagicLetter (MovieClip, name, depth);
MagicLetter = new MagicLetter ( this , "scritta1" , 1 ) ; var ML1: MagicLetter MagicLetter = new (this, "scritta1", 1);
MagicLetter = new MagicLetter ( this , "scritta2" , 2 ) ; var ML2: MagicLetter MagicLetter = new (this, "scritta2", 2);
"Vieni su Undolog.com e scopri altri Script" , 20 , 10 , 50 ) ; ML1. Show ("Come up and see other Undolog.com Script", 20, 10, 50);
"per Adobe Flash MX!" , 20 , 10 , 120 ) ; ML2. Show ("Adobe Flash MX", 20, 10, 120);

There are no comments for this post

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL