.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title ".::SWF::Movie 3pm" .TH .::SWF::Movie 3pm "2011-10-26" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SWF::Movie \- SWF Movie class .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use SWF::Movie; \& \& $m = new SWF::Movie(); \& $m = SWF::Movie::newSWFMovieWithVersion(8); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" SWF::Movie is the root object of your flashfile. It contains all your other objects you want in your movie. Ming supports many Flash4, Flash5 F6,7,8,9.. features. .PP The SWF::Movie object contains information like the flashversion, the size, the frames per second, the background color. Except that, the SWF::Movie behaves like a SWF::MovieClip. It only cannot be added to another SWF::Movie or SWF::MovieClip. .PP Notice: The version of your flashmovie can be set by the object \s-1SWF\s0. See \s-1SWF\s0 for more details. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$m = new \fISWF::Movie()\fR" 4 .el .IP "\f(CW$m\fR = new \fISWF::Movie()\fR" 4 .IX Item "$m = new SWF::Movie()" Creates a Movie object. .ie n .IP "$m = newSWFMovieWithVersion(version)" 4 .el .IP "\f(CW$m\fR = newSWFMovieWithVersion(version)" 4 .IX Item "$m = newSWFMovieWithVersion(version)" Creates a Movie object with version value (e.g. 8) set. .ie n .IP "$displayItem=$m\->add($SWFObject)" 4 .el .IP "\f(CW$displayItem\fR=$m\->add($SWFObject)" 4 .IX Item "$displayItem=$m->add($SWFObject)" Add an instance of a SWF-object to your current frame. The returnvalue is a SWF::DisplayItem. .Sp .Vb 1 \& Some possible SWF\-objects are: \& \& SWF::Action \& SWF::MovieClip \& SWF::Shape \& SWF::Sound \& SWF::Text \& SWF::TextField \& SWF::Bitmap \& SWF::PrebuiltClip \& \& $m\->add($shape); # possible, but not more accessible for us \& $shape_1 = m\->add($shape); # good instance .Ve .ie n .IP "$m\->addExport($block, $name)" 4 .el .IP "\f(CW$m\fR\->addExport($block, \f(CW$name\fR)" 4 .IX Item "$m->addExport($block, $name)" Prepare linkage to Action script code. .Sp .Vb 3 \& $m\->addExport($mc, \*(Aqmc\*(Aq); \& # and later inside action script....: \& $ac = new SWF::Action("_root.attachMovie(\*(Aqmc\*(Aq,\*(Aqmc1\*(Aq,11);"); .Ve .ie n .IP "$m\->\fIwriteExports()\fR" 4 .el .IP "\f(CW$m\fR\->\fIwriteExports()\fR" 4 .IX Item "$m->writeExports()" Export prepared names to Action script. .IP "remove($displayItem)" 4 .IX Item "remove($displayItem)" Removes the given SWF::DisplayItem instance from the current and following frames of the main timeline. .Sp .Vb 1 \& $m\->remove($shape_i); .Ve .IP "\fInextFrame()\fR" 4 .IX Item "nextFrame()" Finish a frame of the main timeline. New added objects will be added in the next frame. .Sp .Vb 1 \& $m\->nextFrame(); .Ve .IP "setNumberOfFrames($frames) =item setFrames($frames)" 4 .IX Item "setNumberOfFrames($frames) =item setFrames($frames)" Preset the number of frames of the main timeline. n not used frames before finishing the movie will filled with n \fInextFrame()\fR statements. If you inserted more \fInextFrame()\fR commands than you set with \fIsetFrames()\fR the \fIsetFrames()\fR will be ignored. .Sp .Vb 1 \& $m\->setFrames(100); .Ve .ie n .IP "$m\->setBackground($red,$green,$blue)" 4 .el .IP "\f(CW$m\fR\->setBackground($red,$green,$blue)" 4 .IX Item "$m->setBackground($red,$green,$blue)" Set the background in red, green, blue values. Possible value are 0..255 or hexvalues 0x0..0xff. .Sp .Vb 2 \& $m\-setBackground(0xff,0x99,0x00); # orange bg \& $m\-setBackground(0,200,255) # green bg .Ve .Sp A transparency level isn't available I asume. (In Flash \s-1MX/F6\s0?). A transparent background can be set in the HTML-code for Internet Explorer. Please inform the Authors if that is available for nonIE-browsers. .ie n .IP "$m\->namedAnchor($label)" 4 .el .IP "\f(CW$m\fR\->namedAnchor($label)" 4 .IX Item "$m->namedAnchor($label)" This function adds a named anchor to the movie. .ie n .IP "$m\->setDimension(x,y)" 4 .el .IP "\f(CW$m\fR\->setDimension(x,y)" 4 .IX Item "$m->setDimension(x,y)" Set the dimension in pixel. .Sp .Vb 6 \& #ToDo: \& #min: (0.0,0.0) # ;\-) \& #max: (?,?) \& #default: (0.0?,0.0?) \& #Behavior when values max: ming sets it to max \& \& $m\->setDimension(200,100); \& $m\->setDimension(123.45,67.89); .Ve .ie n .IP "$m\->setRate(int)" 4 .el .IP "\f(CW$m\fR\->setRate(int)" 4 .IX Item "$m->setRate(int)" Set the playing speed in frames/second. .Sp .Vb 6 \& #ToDo: \& #min: 0 \& #max: ? \& #default: ? \& #Behavior when value max: ming sets it to max \& \& $m\->setRate(30); .Ve .ie n .IP "$m\->\fIprotect()\fR" 4 .el .IP "\f(CW$m\fR\->\fIprotect()\fR" 4 .IX Item "$m->protect()" A feature that prevents only flashnewbies from importing your movie into Macromedias Flash authoring tools. It cannot protect your content from being loaded by other flashmovies, deleting of the protection with a hexeditor or disassembling with tools. .ie n .IP "$m\->setSoundStream($soundstream, [$skip])" 4 .el .IP "\f(CW$m\fR\->setSoundStream($soundstream, [$skip])" 4 .IX Item "$m->setSoundStream($soundstream, [$skip])" Puts an SWF::SoundStream object as streaming sound into the main timeline. The optional skip parameter describes the time in seconds to be skiped. .Sp .Vb 1 \& $m\->setSoundStream($soundstream); .Ve .ie n .IP "$m\->streamMp3($filename)" 4 .el .IP "\f(CW$m\fR\->streamMp3($filename)" 4 .IX Item "$m->streamMp3($filename)" Simplifies the \fIsetSoundStream()\fR. You only need the filename. .Sp .Vb 1 \& $m\->streamMp3("iloveyou.mp3"); .Ve .Sp Hint: If you want to reuse this sound/mp3 later in this movie, create a reusable SWF::SoundStream object and then put it into \fIsetSoundstream()\fR. .ie n .IP "$soundinstance = $m\->startSound($sound)" 4 .el .IP "\f(CW$soundinstance\fR = \f(CW$m\fR\->startSound($sound)" 4 .IX Item "$soundinstance = $m->startSound($sound)" Play a prepared SWF::Sound object into the main timeline. Returns an object of SWF::SoundInstance. .Sp .Vb 2 \& $sound = new SWF::Sound("loveyoutoo.mp3", SWF_SOUND_MP3_COMPRESSED ); \& $si = $m\->startSound($sound); .Ve .ie n .IP "$m\->stopSound($sound)" 4 .el .IP "\f(CW$m\fR\->stopSound($sound)" 4 .IX Item "$m->stopSound($sound)" Stop playing sound. .ie n .IP "$m\->labelFrame($string)" 4 .el .IP "\f(CW$m\fR\->labelFrame($string)" 4 .IX Item "$m->labelFrame($string)" Gives the current frame a label that can be used by actionscript as anchor. Then you don't have to count your \fInextFrame()\fR lines anymore. :\-) .Sp .Vb 5 \& $m\->labelFrame("win"); \& #ToDo: \& #max characters of a label??? \& #What happen if we put there a big string?? \& #Which characters are allowed?? .Ve .ie n .IP "$m\->setScriptLimits($maxRecursion, $timeout)" 4 .el .IP "\f(CW$m\fR\->setScriptLimits($maxRecursion, \f(CW$timeout\fR)" 4 .IX Item "$m->setScriptLimits($maxRecursion, $timeout)" Set limits for resource usage, related to action script. Setting timeout will protect your computer from too long loops and stack overflow. So endless scripts like \*(L"while (1){};\*(R" will be interrupted after timeout seconds. The default recursion depth is 265, the default timeout is 15 seconds. .ie n .IP "$m\->defineScene($offset, $name)" 4 .el .IP "\f(CW$m\fR\->defineScene($offset, \f(CW$name\fR)" 4 .IX Item "$m->defineScene($offset, $name)" Define scenes for the movies' main timeline using integer value for frame offset and name of the scene. .ie n .IP "$m\->setNetworkAccess($flag)" 4 .el .IP "\f(CW$m\fR\->setNetworkAccess($flag)" 4 .IX Item "$m->setNetworkAccess($flag)" Sets network / fileaccess policy. If the flag is set to 0 a localy loaded movie will be unable to access the network but is allowed to access local files. If the flag ist set to 1 a localy loaded movie will be unable to access local files but is allowed to access the network. For \s-1SWF\s0 >= 8: default is 0, .ie n .IP "$m\->addMetadata($xml)" 4 .el .IP "\f(CW$m\fR\->addMetadata($xml)" 4 .IX Item "$m->addMetadata($xml)" Adds Metadata to the movie: this function inserts a metadata-tag into the movie. Only one metadata-tag can be set to a movie. Metadata is specified as an \s-1XML\s0 string. .ie n .IP "$m\->assignSymbol($character, $name)" 4 .el .IP "\f(CW$m\fR\->assignSymbol($character, \f(CW$name\fR)" 4 .IX Item "$m->assignSymbol($character, $name)" Assigns a symbolic name for a SWF::Character object. Such classes are available for usage in other \s-1SWF\s0 files and can be referenced from inside the current movie. To assign a symbol to the root movie use \s-1NULL\s0 as character value. .ie n .IP "$m\->setTabIndex($depth, $index)" 4 .el .IP "\f(CW$m\fR\->setTabIndex($depth, \f(CW$index\fR)" 4 .IX Item "$m->setTabIndex($depth, $index)" Sets tab index for specified depth level. .ie n .IP "$fontchar = $m\->addFont($font)" 4 .el .IP "\f(CW$fontchar\fR = \f(CW$m\fR\->addFont($font)" 4 .IX Item "$fontchar = $m->addFont($font)" Adds a font to a movie. An object of SWF::FontCharacter class returned. .Sp .Vb 2 \& $font = new SWF::Font(\*(AqArial.fdb\*(Aq); \& $fch = $m\->addFont($font); .Ve .ie n .IP "$fontchar = $m\->importFont($file, $name)" 4 .el .IP "\f(CW$fontchar\fR = \f(CW$m\fR\->importFont($file, \f(CW$name\fR)" 4 .IX Item "$fontchar = $m->importFont($file, $name)" Imports a font from an other SWFFile. An object of SWF::FontCharacter class returned. .Sp .Vb 1 \& $fch = $m\->importFont(\*(AqtextField.swf\*(Aq, \*(AqArial337a\*(Aq); .Ve .ie n .IP "$m\->importCharacter($url, $name)" 4 .el .IP "\f(CW$m\fR\->importCharacter($url, \f(CW$name\fR)" 4 .IX Item "$m->importCharacter($url, $name)" Not yet documented (ToDo!) .ie n .IP "$result = $m\->replace($item, $block)" 4 .el .IP "\f(CW$result\fR = \f(CW$m\fR\->replace($item, \f(CW$block\fR)" 4 .IX Item "$result = $m->replace($item, $block)" This method replaces a displayable character with a new one. Returns 0 on success , \-1 else. .Sp .Vb 4 \& $dispitem = $movie\->add($shape1); \& $movie\->nextFrame(); \& print $movie\->replace($dispitem, $shape2); \& $movie\->nextFrame(); .Ve .ie n .IP "$written = $m\->xs_output([$compresslevel])" 4 .el .IP "\f(CW$written\fR = \f(CW$m\fR\->xs_output([$compresslevel])" 4 .IX Item "$written = $m->xs_output([$compresslevel])" .PD 0 .ie n .IP "$written = $m\->output([$compresslevel])" 4 .el .IP "\f(CW$written\fR = \f(CW$m\fR\->output([$compresslevel])" 4 .IX Item "$written = $m->output([$compresslevel])" .PD Writes the SWF::Movie to stdout. This is normally used for webservers/cgi\-scripts. Don't forget to send the \*(L"Content\-Type:\*(R"\-lines before writing out the movie. .Sp The parameter compresslevel is optional. compresslevel between 0 and 9. Higher values will be interpreted as 9. Values smaller 0 mean no compression. By default the SWF::Movie will be send without compression. Notice: compression available since Flash \s-1MX\s0(Flash 6). Ming does not check this for you if you write flash4 or flash5 movies. .Sp Unlike \fIxs_output()\fR the \fIoutput()\fR method prepared for using via webservers (but not limited to webservers). .Sp Both methods return number of bytes written. .ie n .IP "$written = $m\->save($filename [, $compresslevel])" 4 .el .IP "\f(CW$written\fR = \f(CW$m\fR\->save($filename [, \f(CW$compresslevel\fR])" 4 .IX Item "$written = $m->save($filename [, $compresslevel])" Method saves the SWF::Movie to a file and returns the number of bytes written. The parameter compresslevel is optional. compresslevel between 0 and 9. Higher values will be interpreted as 9. Values smaller 0 mean no compression. By default the SWF::Movie will be saved without compression. Notice: compression available since Flash \s-1MX\s0(Flash 6). Ming does not check this for you if you write flash4 or flash5 movies. .SH "EXAMPLE" .IX Header "EXAMPLE" 3 examples: a regular minimal SWF::Movie, one with all methods and a more interesting. .IP "minimal empty example" 4 .IX Item "minimal empty example" .Vb 2 \& #!/usr/bin/perl \-w \& use SWF::Movie; \& \& $m = new SWF::Movie(); \& $m\->nextFrame(); \& $m\->save("emptyminimal.swf"); .Ve .IP "full empty examples" 4 .IX Item "full empty examples" .Vb 2 \& #!/usr/bin/perl \-w \& use SWF::Movie; \& \& $m = new SWF::Movie(); \& $m\->setVersion(4); \& $m\->setBackground(0xff,0xcc,0x0); \& $m\->setDimension(200,100); \& $m\->protect(); \& $m\->setRate(30); \& $m\->setFrames(10); # ming fills it automatic with frames \& \& $m\->nextFrame() \& $m\->save("empty.swf"); .Ve .IP "streaming example" 4 .IX Item "streaming example" .Vb 3 \& #!/usr/bin/perl \-w \& use SWF("Shape"); \& SWF::setVersion(6); \& \& $m = new SWF::Movie(); \& $m\->setBackground(0xff,0xcc,0x0); \& $m\->setDimension(200,100); \& $m\->setFrames(10); \& $m\->streamMp3("forever.mp3"); \& \& $s= new SWF::Shape(); \& $s\->setLine(40,0xff,0xff,0); \& $s\->setRightFill(0xff,0,0); \& $s\->drawLine(50,0); \& $s\->drawLine(0,20); \& $s\->drawLineTo(0,0); \& \& $s_1= $m\->add($s); \& $s_2= $m\->add($s); \& $s_1\->move(50,40); \& $s_2\->move(10,40); \& for($i=1;$i<5;$i++) { \& $m\->nextFrame(); \& $s_2\->move(0,10); \& } \& $m\->nextFrame(); \& print "Content\-type: application/x\-shockwave\-flash\en\en"; \& $m\->output(9); # with compression level 9 (since flash6) .Ve .SH "AUTHOR" .IX Header "AUTHOR" Soheil Seyfaie (soheil at users.sourceforge.net), Albrecht Kleine and developers of ming.sourceforge.net .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1SWF\s0, SWF::Action, SWF::Bitmap, SWF::Button, SWF::Constants, SWF::DisplayItem, SWF::Fill, SWF::Font, SWF::FontCharacter, SWF::Gradient, SWF::Morph, SWF::MovieClip, SWF::Shape, SWF::PrebuiltClip, SWF::Sound, SWF::SoundStream, SWF::TextField, SWF::Text, SWF::Filter, SWF::Character