1.::SWF::Button(3) User Contributed Perl Documentation .::SWF::Button(3)
2
3
4
6 SWF::Button - SWF button class
7
9 use SWF::Button;
10 $button = new SWF::Button();
11 $button->setUp($shape1);
12 $button->setDown($shape2);
13
15 Creates buttons for flash movies. Buttons are controlled by various
16 methods for visible design and triggered actions, see below:
17
19 new SWF::Button()
20 Creates a new Button object.
21
22 $button->addShape($shape, FLAG)
23 Adds $shape to the button. Using this method is not recommended,
24 better use addCharacter(), see next item for details. Also unlike
25 addCharacter() this method does not return any SWF::ButtonRecord
26 objects
27
28 $buttonrecord = $button->addCharacter($character [, $flags])
29 Adds character $shape to the button. Valid FLAGs are:
30
31 SWFBUTTON_HIT
32 SWFBUTTON_UP
33 SWFBUTTON_DOWN
34 SWFBUTTON_OVER
35
36 Unlike addShape() this method returns an object of
37 SWF::ButtonRecord class. The flag states can be combined using the
38 binary or operator.
39
40 $buttonrecord = $button->setOver($shape)
41 Shortcut for $button->addCharacter($shape, SWFBUTTON_OVER);
42
43 $buttonrecord = $button->setHit($shape)
44 Shortcut for $button->addCharacter($shape, SWFBUTTON_HIT);
45
46 $buttonrecord = $button->setUp($shape)
47 Shortcut for $button->addCharacter($shape, SWFBUTTON_UP);
48
49 $buttonrecord = $button->setDown($shape)
50 Shortcut for $button->addCharacter($shape, SWFBUTTON_DOWN);
51
52 $button->addAction($action [,FLAG])
53 $button->setAction($action [,FLAG])
54 Adds $action object (see SWF::Action). Valid FLAGs are:
55
56 SWFBUTTON_MOUSEUP
57 SWFBUTTON_MOUSEOVER
58 SWFBUTTON_MOUSEOUT
59 SWFBUTTON_MOUSEDOWN
60 SWFBUTTON_DRAGOVER
61 SWFBUTTON_DRAGOUT
62
63 SWFBUTTON_MOUSEUP is the default value of FLAG.
64
65 $button->setMenu(0|1)
66 Parameter is 0 (off) or 1(on). Can be used for a slight different
67 behavior of buttons.
68
69 $soundinstance = $button->addSound($sound, $flags)
70 Plays a prepared SWF::Sound object and returns an object of
71 SWF::SoundInstance. Once more valid flags are:
72
73 SWFBUTTON_MOUSEUP
74 SWFBUTTON_MOUSEOVER
75 SWFBUTTON_MOUSEOUT
76 SWFBUTTON_MOUSEDOWN
77
78 For example:
79
80 $sound = new SWF::Sound("wow.mp3", SWF_SOUND_MP3_COMPRESSED );
81 $soundinstance = $button->addSound($sound, SWFBUTTON_MOUSEDOWN );
82
83 $button->setScalingGrid($x, $y, $w, $h)
84 This function (available from SWF>=8) sets a 9 slice scaling grid:
85 1 2 3 4 5 6 7 8 9 X, y, w and h define a rectangle, which is the
86 dimension of the center slice (5). All other slices are determined
87 out of the characters bounds and the defined rect. While slice 5 is
88 scaled vertical and horizontal, slice 2 and 8 are only scaled
89 horizontal. Slice 4 and 6 only vertical. The 4 corner slices are
90 not scaled (1, 3, 7, 9).
91
92 $button->removeScalingGrid()
93 Removes scaling grid rectangles.
94
96 wrapper written by
97
98 Soheil Seyfaie (soheil at users dot sourceforge dot net) Peter
99 Liscovius (peterdd at users dot sourceforge dot net) and many others.
100
102 SWF, SWF::Action, SWF::Shape, SWF::Movie, SWF::MovieClip,
103 SWF::Constants, SWF::Sound, SWF::SoundInstance
104
105
106
107perl v5.32.0 2020-07-28 .::SWF::Button(3)