Some ActionScript code (triangle.as) which displays a triangle and a rotating rectangle:
_root.createEmptyMovieClip('triangle', 1); with (_root.triangle) { lineStyle(10, 0xff0000, 100); moveTo(200, 200); lineTo(300, 300); lineTo(100, 300); lineTo(200, 200); }; var r:MovieClip = createEmptyMovieClip('rectangle', 2); r.beginFill(0xcc00cc, 100); r.moveTo(20, 20); r.lineTo(140, 20); r.lineTo(140, 140); r.lineTo(20, 140); r.endFill(); r._x = 230; r._y = 190; r.onEnterFrame = function() { this._rotation += 5; };
Compile it using ming (a library for generating Macromedia Flash files, .swf):
makeswf -r 12 -v 9 -o triangle.swf triangle.aswhere -r specifies the frames-per-second and -v gives the Flash format/version to create (up to 9 is supported).
Finally, embed the scary Flash thing:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="home" align=""> <param name="movie" value='/as/triangle.swf'> <param name="quality" value="high"> <param name="bgcolor" value="#ffffff"> <embed src='/as/triangle.swf' quality="high" bgcolor="#ffffff" width="550" height="400" name="home" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </object>
posted at: 09:57 | path: /programming | permanent link