Archive for the 'JSFL' Category

Latest JSFL Documentation - CS3

January 30th, 2008 | Category: CS3, JSFL

Download CS3 JSFL Documentation here

This is a link to the latest and greatest JSFL documentation - CS3. Grab it while it’s hot. It’s full of stuff that wasn’t in there in previous documentation. If this link ever goes bad and it shouldn’t, leave me a comment and I will put it up myself. Enjoy.

No comments

JSFL – Set selected objects on a whole pixel in CS3

January 22nd, 2008 | Category: CS3, JSFL

I haven’t posted in a while. This is a very simple yet effective JSFL I wrote for a coworker. He needed an easy way to set all the objects he had selected on stage to a whole pixel. Sometimes vectors get blurry if they land on a fraction of a pixel and clients can be quick to point this out. It would suck to do this manually if you had any number larger than 12. Imagine if you had 200 objects onstage and everyone was potentially not on a whole pixel. The world would be doomed without this.

 

// An array of objects that are selected.
var objects = fl.getDocumentDOM().selection
// Loop thru the objects and set their X and Y coordinates to a round number.
for(var i = 0; i < objects.length; i++){
objects[i].x = Math.round(objects[i].x)
objects[i].y = Math.round(objects[i].y)
}

 

Thats it. Stick the above code in a JSFL file, select some objects and run it.
SOURCE FILE

 

 

No comments

JSFL – Guide / Unguide Selected Layers

January 13th, 2008 | Category: JSFL

JSFL is one of those magic features in Flash that could possibly change your life (or at least put a huge smile on your face). If you are like me and deal with multitudes of layers on a single timeline and use the “guide layers” functionality frequently, this post is for YOU!!!

Wouldn’t it be great if you could select 10 layers at once and set them all as guided. The way we have always done it till now is if there are multiple layers that need to be guided, we would have to select layer / right click / guide layer for each one individually. I wrote this script to handle that redundant task and I share it with you.
——————————————————————————-

/*

My favorite part about this script is that if you select guided layers along with unguided layers, their statuses will be toggled.
Title: Guide / Unguide Layers
Action: Guides selected unguided layers and vice versa.
Author: Charles D Clements
Date: 10/11/07

*/

// Create an Array of the layer indeces.
var layerArray = fl.getDocumentDOM().getTimeline().getSelectedLayers();
// Loop thru Array.
for(a = 0; a < layerArray.length; a++){
var numLayer = layerArray[a]
var thisLayer = fl.getDocumentDOM().getTimeline().layers[numLayer]
switch(thisLayer.layerType){
case ‘normal’:
thisLayer.layerType = “guide”;
break
case ‘guide’:
thisLayer.layerType = “normal”;
break
}
}
——————————————————————————-

No comments

JSFL – Colorize Selected Layers

January 13th, 2008 | Category: JSFL

When you start working projects with heavy timeline animations you learn real quick that is is best to be as organized as possible. I guess that is true in all aspects of life. Here is one small tool that will help. Colorize Selected Layers will take the layers selected and make all of the outlines a uniform color that you specify. The script is very short and sweet.

——————————————————————————-

/*

Action: Takes the layers selected and make all of the outlines a uniform color that you specify.
Author: Charles D Clements
Date: 10/11/07

*/
// Color var
var hex = prompt(”What color do you want the layers? ex: FF0022:”);
// Create an Array of the layer indeces.
var layerArray = fl.getDocumentDOM().getTimeline().getSelectedLayers();
// Loop thru Array of layers
for(a = 0; a < layerArray.length; a++){
fl.getDocumentDOM().getTimeline().layers[layerArray[a]].color=”#”+hex;
}
——————————————————————————-

No comments

JSFL - How to use JSFL

January 13th, 2008 | Category: JSFL

There are different ways you can use the JSFL scripts on this blog. I will list a few ways that you can get up and running.

1. Quick and dirty. If script is simple and doesn’t require XML (it will be only one AS file), this will work fine just to test it out.
- Create a new JSFL text file in Flash
- Paste in this code
- Save it to your harddrive
- Depending on the command you are trying to run, create the appropriate scenario that the script will be used for (ex: using the ‘Colorize Selected Layers’, you will need to create several layers and select the specified layers to be colorized)
- In the top menu go to Commands/Run Command, then navigate to the saved JSFL file and open it
- Done

2. Proper way. Stick the command file in the Flash Commands folder. This is helpful because the JSFL command will show up in the Commands drop down on the top menu and you won’t need to navigate to the file on your harddrive.
- Create a new JSFL text file in Flash
- Paste in this code
- Save it to or paste the file into the following directory on Windows: C:\Documents and Settings\”YOUR NAME”\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Commands
- Restart Flash
- Depending on the command you are trying to run, create the appropriate scenario that the script will be used for (ex: using the ‘Colorize Selected Layers’, you will need to create several layers and select the specified layers to be colorized)
- Click on the Commands tab in the top navigation and look for the appropriate Command in the dropdown.
- Done

These are the 2 basic ways of using JSFL. I may do a post about packaging JSFL into an MXP file for easy installation at a later date.

Payce

No comments