This script will help you add version info to fla file automatically, and with a little shortcut setting, you may even forget its existence.
Here is the code:
YourName="Frank Li (http://mianwo.blogspot.com)";
function changeVar(as,name,value,sep){
if(sep==undefined){
sep="=";
}
if(as.indexOf(name+sep)!=-1){
var s=as.indexOf(name+sep);
var e=as.indexOf(";",s);
var e2=as.indexOf("
",s);
if(e==-1){
if(e2!=-1){
e=e2;
}else{
e=as.length-1;
}
}
var str=as.substring(s,e);
if(value=="++"){
var ns=name+sep+(Number(str.split(sep)[1])+1);
}else{
var ns=name+sep+value;
}
return as.split(str).join(ns);
}else{
if(value=="++"){
value=1;
}
return name+sep+value+";
"+as;
}
}
var as=fl.getDocumentDOM().timelines[0].layers[0].frames[0].actionScript;
as=changeVar(as,"build_num","++");
as=changeVar(as,"build_time",new Date().getTime());
as=changeVar(as,"//Modified by "+YourName,new Date()," at ");
fl.getDocumentDOM().timelines[0].layers[0].frames[0].actionScript=as;
fl.saveDocument(fl.getDocumentDOM());
fl.getDocumentDOM().testMovie();Create a new jsfl file, copy the above code.
Then modify the first line to your name.
Save it to this path:
Documents and Settings//Local Settings/Application Data/Macromedia///Configuration/Commands/
Then you will have a new item under your flash's command menu. Click it.
Now go to your fla file's first scene, you will found these code in it:
//Modified by Frank Li (http://mianwo.blogspot.com) at Sat Mar 10 11:25:01 GMT+0800 2007;
build_time=1173497101406;
build_num=684;The first line indicates the author and modify date.
The second line is the number format of the date
The third line is the version number, every time you run this command, the number will plus one automatically.
There's another trick to make it more easy to use.
In flash's menu, Click Edit -> Keyboard Shortcuts...
Duplicate a setting from the default one
Find Control -> Test Movie
Delete the default Ctrl-Enter
Then go to Commands -> [your jsfl name]
Set it to Ctrl-Enter
It's done!
Now every time when you Test Movie, the script will add your name, current time and version number to the fla. Quite nice isn't it?
Enjoy!