X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=doc%2Fswfc.xml;h=c5b0ca86c461105e43e6bb32179e69bddd49fe43;hb=e34684d2811b9042f534c2cfad32c9256df574a4;hp=1b8bdc7c69edff75e9093f0573d388af232454cf;hpb=ab0381ad74443bf2cb1250820d01adee6f014dfc;p=swftools.git diff --git a/doc/swfc.xml b/doc/swfc.xml index 1b8bdc7..c5b0ca8 100644 --- a/doc/swfc.xml +++ b/doc/swfc.xml @@ -35,8 +35,8 @@ Line breaking: Links: - http://www.quiss.org OR - Quiss + http://www.quiss.org OR + Quiss Shell scripts, commands to execute: @@ -89,7 +89,7 @@ Boxes: Though swfc is a command-line utility, there also exists a nice graphical - frontend for it, called Swifty. + frontend for it, called Swifty. @@ -178,11 +178,27 @@ If you have a SWF with a font you would like to use, do a Then write down the font ID of the font, and do a - swfextract -f file.swf -o myfont.swf + swfextract -f <fontid> file.swf -o myfont.swf . +

This will give you a file named myfont.swf which you can also use in the filename parameter of .font. +

+ +

+Furthermore, you can convert TTF and Type1 +fonts into SWF using font2swf: + + font2swf Arial.ttf -o Arial.swf + +The nice advantage of this is that you can play +Arial.swf in the flash player and see what the +font looks like. +(Also, loading a font in SWF format is slighly +faster than from a TTF file, as with TTFs spline +conversion has to take place). +

@@ -201,7 +217,7 @@ objects which you can use in other commands. .flash name="fontoutline.swf" .font Arial "Arial.swf" - .textshape helloworld font="arial" text="Hello World" + .textshape helloworld font=Arial text="Hello World" .filled filled_helloworld outline=helloworld fill=blue line=5 color=green .put filled_helloworld .end @@ -216,7 +232,7 @@ of a plain color: .flash name="fontgradient.swf" .font Arial "Arial.swf" - .textshape helloworld font="arial" text="Hello World" + .textshape helloworld font=Arial text="SHADE" .gradient whitefade: 0% black @@ -224,8 +240,8 @@ of a plain color: 100% yellow .end - .filled filled_helloworld outline=helloworld fill=blue line=5 color=green - .put filled_helloworld + .filled filled_helloworld outline=helloworld fill=whitefade line=1 color=#2c2c2c + .put filled_helloworld scale=200% .end @@ -237,8 +253,7 @@ them for clipping: .flash name="text5.swf" .font courier "Courier.swf" -.font helvetica "Helvetica.swf" -.text hithere text="HELLO" font=courier size=50% +.text hithere text="HELLO" font=courier size=200% .swf scene Scenery50.swf .frame 0 @@ -258,10 +273,9 @@ which is used here together with the alpha parameter of .change: .flash name="text6.swf" -.font courier "Courier.swf" -.font helvetica "Helvetica.swf" -.text hello text="HELLO" font=helvetica size=50% color=blue -.text world text="WORLD" font=helvetica size=50% color=red +.font times "Times.swf" +.text hello text="HELLO" font=times size=100% color=blue +.text world text="WORLD" font=times size=100% color=red .frame 0 .put hello pin=center x=50 y=50 @@ -274,14 +288,139 @@ which is used here together with the alpha parameter of .change:
+ +ActionScript - +
+ swfc has Actionscript support. + For normal actionscript, which is executed once a given frame + is reached, just open an .action block, and write + the ActionScript into the block: + + +.flash name="action.swf" bbox=300x300 fps=50 +.box mybox color=blue fill=green width=100 height=100 +.put mybox +.frame 0 + .action: + _root.angle += 0.3; + mybox._x = 100*Math.cos(_root.angle)+100; + mybox._y = 100*Math.sin(_root.angle)+100; + .end +.frame 1 + .action: + gotoFrame(0); + Play(); + .end +.frame 2 +.end + + +Or, for much more interesting ActionScript examples, see +Laurent Lalanne's +Flash Eyes +or the +source +of Jean-Michel Sarlat's +Mandelbrot explorer. + +
+Buttons +

+Actionscript comes in handy when dealing with SWF Buttons. +

+

+A button defines, in SWF context, an object sensitive to mouse movement, +mouse buttons, and key presses. +

+

+The following is a trivial example: Four objects which change their shape +once the cursor is over it. + +.flash name="button1.swf" fps=50 + +.box box1 color=white fill=#336633 width=50 height=50 +.box box2 color=white fill=#99cc99 width=100 height=100 +.button mybutton1 + .show box1 as=shape x=25 y=25 + .show box2 as=hover x=12.5 y=12.5 +.end + +.frame 0 + .put b1=mybutton1 + .put b2=mybutton1 x=100 red=+255 + .put b3=mybutton1 y=100 green=+255 + .put b4=mybutton1 x=100 y=100 blue=+255 +.end + +

+ +

+The .show command (which can only be used inside .button) has a syntax +very similar to .put. +For every shape a button uses, you can specify the position, color transform, scaling, +rotation etc. just like with .put. +

+

+The only real difference between those two commands is the as parameter: +with that you tell the button when to display that specific shape. +There are four allowed parameters to as: +

    +
  • idle The shape to display when the button is idle, that is, the + mouse is somewhere else, and not over the button. +
  • hover The shape to display if the mouse cursor is inside the button. + What exactly is "inside" is defined by area: +
  • area This shape is not displayed. It serves as bounding box (actually, + bounding polygon) for the button. A button considers itself + active (that is, the hover shape is active, not the idle + shape) if the mouse is inside this area. Also, mouse button clicks + have to be in this area for this button. +
  • pressed The shape to display if the user clicks on the button. This shape + is displayed as long as the mouse button is down. +
  • +
+

+ + + +