For a few different reasons I decided to write some php code to convert timeline code to a document class. The script is done and it seems to work pretty nicely. I’m sure there are a few bugs, but I’ve tested around 30 snippets from this site and they all worked.
To test it out:
1) just take the below code (or any other timeline code), copy it to your clipboard
(The code doesn’t have to be small, I did a test with 300 lines of timeline code and it worked just fine)
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
var xp:Number = 0, yp:Number = 0;
var r:Number = 0, t:Number = 0;
var speed:Number = .07;
var scale:Number = 20;
var plot0:Shape = Shape(addChild(new Shape()));
var plot1:Shape = Shape(addChild(new Shape()));
plot0.graphics.lineStyle(0,0x000000);
plot1.graphics.lineStyle(0,0x000000);
addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
r = scale * Math.sqrt(t);
xp = r * Math.cos(t);
yp = r * Math.sin(t);
t += speed;
plot0.graphics.lineTo(xp, yp);
plot1.graphics.lineTo(-xp, -yp);
}
2) go to this page and follow the instructions:
http://actionsnippet.com/timeline_to_doc.php
I used this script to convert a few snippets from this site to work on wonderfl.net…
In the next few days I may add a button to all code snippets that allows you to convert the code to a doc class…
The script adds import statements automatically, I may however have missed a few packages, so if the generated code is missing an import statement, let me know and I’ll fix it…

