blog.minimal.be waiting to find out how to save the world…

2Aug/090

Playing with JSFL

My first attempt with JSFL. I needed to convert vector drawings to graphics commands to use them with VectorVision (PaperVision3D's VectorShape classes).

Select the shape on the stage, and run the script. The AS instructions will flow in the output panel.


// with a shape selected
var elt = fl.getDocumentDOM().selection[0];

var contourArray = elt.contours;
var contourCount = contourArray.length;

// get colors
var colors = [];
for (i=1; i {
colors.push( contourArray[i].fill.color );
}

fl.trace( 'var g:Graphics3D = new Graphics3D();' );

// enter edit mode to get vertices
elt.beginEdit();

var contourArray = elt.contours;
var contourCount = contourArray.length;

for (i=1; i {
var contour = contourArray[i];

fl.trace( '// shape #' + i + ' of ' + (contourCount-1) );
fl.trace( 'g.beginFill( 0x' + colors.shift().substr(1) + ' );' );

var he = contour.getHalfEdge();
var iStart = he.id;
var id = 0;

while (id != iStart)
{
// Get the next vertex.
var vrt = he.getVertex();
if ( id ) fl.trace( 'g.lineTo( '+ vrt.x + ', ' + -vrt.y + ' );' );
else fl.trace( 'g.moveTo( '+ vrt.x + ', ' + -vrt.y + ' );' );
he = he.getNext();
id = he.id;
}

fl.trace( 'g.endFill();' );
fl.trace( '' );
}

elt.endEdit();

2Aug/090

Where are my cfeclipse snippets ?

In the workspace folder of your Eclipse installation, there is a (hidden) .metadata folder that contains configuration data for the application and its plugins.

I found my cfeclipse snippets xml files there :

~/Documents/Flex Builder 3/.metadata/.plugins/org.cfeclipse.cfml/snippets

When migrating from Flex to Flash Builder, just copy the snippets folder content. Don't forget to configure the keyboard shortcut back to what you were used to, and welcome home !

24Jun/090

Hello world

trace( 'this blog is online since ' + new Date().toDateString() );

Filed under: Uncategorized No Comments