{"id":739,"date":"2009-02-20T07:54:32","date_gmt":"2009-02-19T23:54:32","guid":{"rendered":"http:\/\/nick.onetwenty.org\/?p=739"},"modified":"2009-02-20T07:57:07","modified_gmt":"2009-02-19T23:57:07","slug":"flash-development-for-c-programmers","status":"publish","type":"post","link":"https:\/\/nick.onetwenty.org\/index.php\/2009\/02\/20\/flash-development-for-c-programmers\/","title":{"rendered":"Flash development for C programmers"},"content":{"rendered":"<p>Well, for C programmers using (<a href=\"http:\/\/www.ubuntu.com\/\">Ubuntu<\/a>) <a href=\"http:\/\/www.gnu.org\/\">GNU<\/a>\/<a href=\"http:\/\/www.linux.org\/\">Linux<\/a>&#8230; similar instructions may apply for Windows development.<\/p>\n<p>Install the ActionScript2 compiler (<a href=\"http:\/\/www.mtasc.org\/\">mtasc<\/a>):<\/p>\n<pre lang=\"bash\">\r\nsudo aptitude install mtasc\r\n<\/pre>\n<p>Write an ActionScript2 program (in a file called &#8220;main.as&#8221;):<\/p>\n<pre lang=\"actionscript\">\r\nclass App\r\n{\r\n\tstatic function main(mc)\r\n\t{\t\r\n\t\t_root.createTextField(\"tf\",0,0,0,320, 240);\r\n\t\t\r\n\t\t_root.onMouseMove = function()\r\n\t\t{\r\n\t\t\t_root.tf.text = \"X: \" + _root._xmouse + \"\\nY: \" + _root._ymouse;\r\n\t\t}\r\n\t} \r\n}\r\n<\/pre>\n<p>Create a makefile:<\/p>\n<pre lang=\"make\">\r\nCC = mtasc\r\nCFLAGS = -main -header 320:240:20:666666\r\nDEBUG = -v\r\nDEPS = main.as\r\n\r\ndefault: example\r\n\r\nexample:\r\n\t$(CC) $(CFLAGS) -swf example.swf $(DEPS)\r\n\t\r\nclean:\r\n\trm -f example.swf\r\n<\/pre>\n<p>Run make:<\/p>\n<pre lang=\"bash\">\r\nmake\r\n<\/pre>\n<p>(Hmmm, it was probably a little gratuitous making that command explicit here&#8230;)<\/p>\n<p>Embed flash applet in a webpage using the following html embed snippet:<\/p>\n<pre lang=\"html4strict\">\r\n<object width=\"320\" height=\"240\">\r\n<param name=\"movie\" value=\"example.swf\">\r\n\r\n<\/object>\r\n<\/pre>\n<p>Final product (mouse-over for action&#8230; well&#8230; &#8220;not inaction&#8221;):<\/p>\n<p><object width=\"320\" height=\"240\"><param name=\"movie\" value=\"example.swf\"><\/object><\/p>\n<p>Next steps: <a href=\"http:\/\/swfmill.org\/\">swfmill<\/a> and <a href=\"http:\/\/www.inkscape.org\/\">Inkscape<\/a>&#8230; maybe <a href=\"http:\/\/haxe.org\/\">haxe<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, for C programmers using (Ubuntu) GNU\/Linux&#8230; similar instructions may apply for Windows development. Install the ActionScript2 compiler (mtasc): sudo aptitude install mtasc Write an ActionScript2 program (in a file called &#8220;main.as&#8221;): class App { static function main(mc) { _root.createTextField(&#8220;tf&#8221;,0,0,0,320, 240); _root.onMouseMove = function() { _root.tf.text = &#8220;X: &#8221; + _root._xmouse + &#8220;\\nY: &#8221; + &hellip; <a href=\"https:\/\/nick.onetwenty.org\/index.php\/2009\/02\/20\/flash-development-for-c-programmers\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Flash development for C programmers&#8221;<\/span><\/a><\/p>\n","protected":false},"author":67,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paLsRH-bV","_links":{"self":[{"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/posts\/739"}],"collection":[{"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/comments?post=739"}],"version-history":[{"count":16,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/posts\/739\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/posts\/739\/revisions\/756"}],"wp:attachment":[{"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/media?parent=739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/categories?post=739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nick.onetwenty.org\/index.php\/wp-json\/wp\/v2\/tags?post=739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}