SWFC Manual


Basic usage of swfc   Fonts   Shapes   >ActionScript<   Buttons   Blend Modes   Filters  

4.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:

Code listing 4.1

.flash filename="action.swf" bbox=300x300 fps=50

.box mybox color=blue fill=green width=100 height=100
.put mybox

.frame 1
    .action:
        _root.angle += 0.05;
        mybox._x = 100*Math.cos(_root.angle)+100;
        mybox._y = 100*Math.sin(_root.angle)+100;
    .end
.frame 2
    .action:
        gotoFrame(0);
        Play();
    .end
.frame 3
.end

For much more interesting ActionScript examples, see Laurent Lalanne's Flash Eyes or the source of Jean-Michel Sarlat's Mandelbrot explorer. or Sunder Iyer's swfc pages.
Previous: Shapes SWFC Manual: ActionScript Next: Buttons