1.::SWF::DisplayItem(3)User Contributed Perl Documentation.::SWF::DisplayItem(3)
2
3
4

NAME

6       SWF::DisplayItem - SWF DisplayItem class
7

SYNOPSIS

9               use SWF::DisplayItem;
10               $dispitem = $movie->add($shape);
11               $dispitem->rotate(45);
12

DESCRIPTION

14       When you place an SWF object (one of the types that can be seen with
15       eyes by user) in a frame of a SWF::Movie or SWF::MovieClip, the return
16       value will be in a SWF::DisplayItem.
17
18       You can now modify that item in current and every following frames of
19       the clip where you added the SWF object.
20
21       Further it is accessible by ActionScript too.  Just give the
22       DisplayItem a name with method setName($name) after you added the SWF
23       object to a SWF::Movie or SWF::MovieClip
24

METHODS

26       $displayItem->moveTo($x, $y);
27           Move $displayItem to ($x, $y) in global co-ordinates.
28
29       $displayItem->move($x, $y);
30           Displace $displayItem by ($x, $y)
31
32       $displayItem->scaleTo($x [,$y]);
33           Set $displayItem scale to $x in the x-direction and $y in the
34           y-direction. If $y is not specified, $y=$x is assumed.
35
36       $displayItem->scale($x [,$y]);
37           Multiply $displayItem scale by $x in the x-direction and $y in the
38           y-direction. If $y is not specified, $y=$x is assumed.
39
40       $displayItem->rotateTo($degrees);
41           Set $displayItem rotation to $degrees.
42
43       $displayItem->rotate($degrees);
44           Rotate $displayItem by $degrees.
45
46       $displayItem->skewX($x);
47           Add $x to the current x-skew.
48
49       $displayItem->skewXTo($x);
50           Set x-skew to $x. 1.0 is 45-degree forward slant. More is more
51           forward while less is more backward.
52
53       $displayItem->skewY($y);
54           Add $y to the current y-skew.
55
56       $displayItem->skewYTo($y);
57           Set y-skew to $y. 1.0 is 45-degree upward slant. More is more
58           upward while less is more downward.
59
60       $displayItem->setMatrix($a, $b, $c, $d, $e, $f)
61           Do an operation of rotating/skewing (b,c), moving (e,f) and scaling
62           (a,d) at once.  The default initial values of an SWF::DisplayItem
63           object's matrix are 1.0, 0, 0, 1.0, 0, 0 .  So calling setMatrix
64           with these defaults (setMatrix(1.0, 0, 0, 1.0, 0, 0);) will reset
65           results of earlier calls of SWF::DisplayItem methods (like
66           rotate(45) etc. etc.)
67
68       $displayItem->setDepth($depth);
69           Set Z-order of $displayItem to $depth.
70
71       $displayItem->setRatio($ratio);
72           Useful for SWF::Morph. Sets $displayItem ratio to $ratio.
73
74       $displayItem->setColorAdd($r, $g, $b [,$a]))
75       $displayItem->addColor($r, $g, $b [,$a]);
76           Add RGB color to the $displayItem's color transform. Default value
77           of $a is 1.0
78
79       $displayItem->setColorMult($r, $g, $b [,$a]))
80       $displayItem->multColor($r, $g, $b [,$a]);
81           Multiplies the $displayItem's color transform by the given values.
82           Default value of $a is 1.0
83
84       $displayItem->setName($name);
85           Set $displayItem's name to $name (used for targetting with
86           SWF::Action).
87
88       $displayItem->remove();
89           Remove $displayItem from the movie display list.
90
91       ($x, $y) = $displayItem->getPosition(();
92           Returns displace coordinates of $displayitem.
93
94       $degrees = $displayItem->getRotation();
95           Returns rotation of $displayItem.
96
97       ($x, $y) = $displayItem->getScale();
98           Returns scale of $displayItem in x- and y-direction.
99
100       ($x, $y) = $displayItem->getSkew();
101           Returns x- and y-skew of $displayItem.
102
103       $depth = $displayItem->getDepth();
104           Returns Z-order of $displayItem.
105
106       $displayItem->setMask($level);
107           Sets a mask level: display items with lower or equal depth are
108           masked, any other display items are not masked.  Use setDepth() to
109           control desired masking.
110
111       $displayItem->endMask()
112           End masking started by prior setMask() call.
113
114       $displayItem->addAction( $action, $flags )
115           Add $action, an object of SWF::Action class.  The flags are
116           exported from SWF::Constants.
117
118                   SWFACTION_ONLOAD
119                   SWFACTION_ENTERFRAME
120                   SWFACTION_UNLOAD
121                   SWFACTION_MOUSEMOVE
122                   SWFACTION_MOUSEDOWN
123                   SWFACTION_MOUSEUP
124                   SWFACTION_KEYDOWN
125                   SWFACTION_KEYUP
126                   SWFACTION_DATA
127
128           Using this flags you have control at which events the action will
129           run.
130
131       $displayItem->setBlendMode($mode)
132           Set an alternative blend mode instead of default alpha blend.
133           Possible modes are:
134
135                   SWFBLEND_MODE_NULL
136                   SWFBLEND_MODE_NORMAL
137                   SWFBLEND_MODE_LAYER
138                   SWFBLEND_MODE_MULT
139                   SWFBLEND_MODE_SCREEN
140                   SWFBLEND_MODE_DARKEN
141                   SWFBLEND_MODE_LIGHTEN
142                   SWFBLEND_MODE_ADD
143                   SWFBLEND_MODE_SUB
144                   SWFBLEND_MODE_DIFF
145                   SWFBLEND_MODE_INV
146                   SWFBLEND_MODE_ALPHA
147                   SWFBLEND_MODE_ERASE
148                   SWFBLEND_MODE_OVERLAY
149                   SWFBLEND_MODE_HARDLIGHT
150
151           Here comes some demonstration code:
152
153                   use SWF::Constants qw(:DisplayItem);
154                   # ....
155                   $sh=new SWF::Shape();
156                   $fill = $sh->addFill(255, 0, 0, 255);                           # red
157                   $sh->setRightFill($fill);
158                   $sh->drawLine(440, 0);
159                   $sh->drawLine(0, 380);
160                   $sh->drawLine(-440, 0);
161                   $sh->drawLine(0, -380);
162                   #
163                   $sh2=new SWF::Shape();
164                   $fill2 = $sh2->addFill(0, 255, 0, 255);                         # green
165                   $sh2->setRightFill($fill2);
166                   $sh2->drawLine(240, 0);
167                   $sh2->drawLine(0, 280);
168                   $sh2->drawLine(-240, 0);
169                   $sh2->drawLine(0, -280);
170
171                   $di=$m->add($sh);
172                   $di2=$m->add($sh2);
173                   #  $di2->setBlendMode( SWFBLEND_MODE_NORMAL);                   # would be green  ( as you have expected )
174                   $di2->setBlendMode(  SWFBLEND_MODE_ADD);                        # y e l l o w  ( surprising, a litle bit )
175
176       $displayItem->cacheAsBitmap($flag)
177           Set a flag (value 0 or 1) showing the character can be cached as a
178           bitmap.  This might improve rendering speed, if the object does no
179           change often.  This feature is available for SWF version >= 8 only.
180
181       $displayItem->flush()
182           Writes the SWF::DisplayItem object immediately to the blocklist.
183           Usually MING waits with writing a display item until a frame is
184           closed through a nextFrame() call, because a display items state
185           could be altered for the current frame. By using the flush() method
186           MING does not wait and writes the frame immediately. Therefore an
187           user can influence the swf tag order. Changing a display items
188           state after calling flush() takes effect in the next frame.
189
190       $matrix = $displayItem->getMatrix()
191           Returns an associated SWF::Matrix object.
192
193       $character = $displayItem->getCharacter()
194           Returns the associated SWF::Character object.
195
196       $displayItem->addFilter( $filter )
197           Process the DisplayItem object thru a prepared filter: an object of
198           SWF::Filter class, e.g. BlurFilter or DropShadowFilter.  Filters
199           are available since player version 8.
200
201       $displayItem->setCXform( $cxform )
202           Process the DisplayItem object thru $cxform: a prepared color
203           transformation object of SWF::CXform class.
204

AUTHOR

206       Soheil Seyfaie (soheil AT users.sourceforge.net) Peter Liscovius
207       Albrecht Kleine
208

SEE ALSO

210       SWF, SWF::Button, SWF::Movie, SWF::MovieClip, SWF::Shape, SWF::Text,
211       SWF::TextField, SWF::Filter, SWF::CXform, SWF::Matrix, SWF::Action,
212       SWF::Morph, SWF::Character, SWF::Constants
213
214
215
216perl v5.32.0                      2020-07-28            .::SWF::DisplayItem(3)
Impressum