PDA

View Full Version : jsfl to change mass library items properties


gonnarule
03-28-2006, 02:52 PM
*french version of the post is following the english translation*

Hello all !

I've got a problem with the use of a little JSFL script. Nothing biggy as this script should redefine the following properties of items in my library :

- linkageImportForRS
- linkageExportForAS
- linkageExportForRS
- linkageExportInFirstFrame
- linkageClassName

Here is my jsfl script :

1 var lib = fl.getDocumentDOM().library;
2 lib.selectAll();
3 if (lib.getItemProperty('linkageImportForRS') == true) {
4 lib.setItemProperty('linkageImportForRS', false);
5 }
6 lib.setItemProperty('linkageExportForAS', true);
7 lib.setItemProperty('linkageExportForRS', false);
8 lib.setItemProperty('linkageExportInFirstFrame', true);
9 lib.setItemProperty('linkageClassName', '');

The problem is when I execute this code, I receive this error message :"Line 8 from file "linkage.jsfl" : setItemProperty : argument number 1 is not valide".
The fact is this code was created by historic window (I changed one argument manually in the library and looked at the generated jsfl script in historic window) so I don't know why it doesn't work.

Even more, if I decide to put linkageExportForRS to true inthe script, there is no more execution problems, but the property linkageExportForAS is not set to true, and it's what I'm looking for.

So.. I don't really know how to correct this, if anyone has a clue please reply :) I don't see me changing manually the properties of more than 800 items of my library.
Thanks you =)

P.S.: I'm french, so I hope my english is understable, and thank you for your time.

******************* french version ********************

Bonjour à tous !

Voila.. j ai un probleme avec l'utilisation d'un ptit script JSFL.. rien de bien compliqué puisqu'il s'agit de définir les propriétés suivantes de bitmap dans ma bibliothèque :

- linkageImportForRS
- linkageExportForAS
- linkageExportForRS
- linkageExportInFirstFrame
- linkageClassName

et voici le code du JSFL :

1 var lib = fl.getDocumentDOM().library;
2 lib.selectAll();
3 if (lib.getItemProperty('linkageImportForRS') == true) {
4 lib.setItemProperty('linkageImportForRS', false);
5 }
6 lib.setItemProperty('linkageExportForAS', true);
7 lib.setItemProperty('linkageExportForRS', false);
8 lib.setItemProperty('linkageExportInFirstFrame', true);
9 lib.setItemProperty('linkageClassName', '');

Or quand j'execute ce script je recois une erreur :

"A la ligne 8 du fichier "linkage.jsfl" : setItemProperty : le numéro d'argument 1 est invalide.

C'est plutot étrange parce que ce code sort directement de la fenêtre d'historique de flash...

De plus, si je décide de mettre linkageExportForRS à true dans le script, hop plus de problème lors de l'execution du code, mais par contre la propriété linkageExportForAS ne se met pas a true.. et c principalement ce que je veux.. super =/

Voila.. je ne sais pas comment faire.. bug ou malédiction ? si quelqu'un trouve / a une solution je suis preneur.. 805 images a linker a la main je vais mourrir !!

barry
03-31-2006, 03:41 PM
hi,

this should work. i'm in a bit of a rush, but will try to give an explaination later.

fl.outputPanel.clear();

var doc = fl.getDocumentDOM();
var lib = doc.library;
lib.selectAll();

if(lib.getSelectedItems().length != 0)
{
lib.setItemProperty("linkageExportForRS", false);
lib.setItemProperty("linkageExportForAS",true);
lib.setItemProperty("linkageExportInFirstFrame",true);
}

barry

Bobb
11-19-2007, 09:51 AM
Hi! I have te same problem and can't seem to get it to work...
I tried both the "lib.setProperty("linkageExportForAS", true)" and the "item.linkageExportForAS = true" syntaxes, and couldn't get them to work...

the setProperty thing seems to crash my script when I try to set ExportInFirstFrame, BaseClass, or ClassName. and no matter what I try, the properrties remain the same when I try to change them...

Any Idea?