-
-
Save chrisyour/662796 to your computer and use it in GitHub Desktop.
// # I've assumed you've downloaded and installed the Flash CS4/CS5 Project Panel update at: http://www.gskinner.com/blog/archives/2010/07/project_panel_u.html | |
// # 1. Create this file in: /Users/{you}/Library/Application Support/Adobe/Flash CS4/en/Configuration/Commands | |
// # 2. Then go to Flash => Keyboard Shortcuts... | |
// # 3. Create your shortcut under the Commands menu, I use 'Cmd+Opt+P' | |
function call_method(p_panelName, p_function, p_param){ | |
l = fl.swfPanels.length; | |
if (l == 0) return 'false'; | |
for (i=0; i<l; i++){ | |
if (fl.swfPanels[i].name == p_panelName) return (p_param == null) ? fl.swfPanels[i].call(p_function) : fl.swfPanels[i].call(p_function, p_param); | |
} | |
return 'false'; | |
} | |
call_method('gProject', 'runCompileList'); |
Hi,
We write our ActionScript in TextMate so we haven't encountered that issue.
Perhaps you could try adding something like this to the top of the JSFL file:
for each (var doc in fl.documents) {
fl.trace("Saving \"" + doc.name + "\"...");
doc.save();
}
I haven't tested this though.
Chris
Hmm. Interesting. I added the to the beginning of the jsfl file and now it saves all of the .fla files that are in the project but leaves the .as unsaved. Does the code look specifically for .fla files only. It doesn't seem that way to me unless Flash doesnt recognize .as scripts as fl.documents.
Yes, it looks like fl.documents only targets .fla files. Not really all that handy, is it?
You can find Adobe's extending Flash CS4 documentation online at: http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/WS5b3ccc516d4fbf351e63e3d118a9024f3f-7ffa.html
CS5 docs are at: http://help.adobe.com/en_US/flash/cs/extend/index.html
Let me know if you find a solution and I'll add it to the Gist to help other people who come across this post.
Thanks,
Chris
Great. Will Do! Chris Thanks for your time, it's appreciated.
No problem. Glad this gist was useful.
Chris
Well for now I have just went with a catch all because it seems Flash doesn't give you the ability to catch all open scripts into an array like the fl.documents and then save each individual one. Placing fl.saveAll() after the method call but before fl.openDocument lets Flash prompt you to save any open documents which haven't been saved yet. So a couple extra clicks but it's all worth it. Thanks alot. Here is what the code looks like now.
// # I've assumed you've downloaded and installed the Flash CS4/CS5 Project Panel update at: http://www.gskinner.com/blog/archives/2010/07/project_panel_u.html
// # 1. Create this file in: /Users/{you}/Library/Application Support/Adobe/Flash CS4/en/Configuration/Commands
// # 2. Then go to Flash => Keyboard Shortcuts...
// # 3. Create your shortcut under the Commands menu, I use 'Cmd+Opt+P'
function call_method(p_panelName, p_function, p_param){
// # Save all open documents before testing project - Stat1124 - 01052011
fl.saveAll();
fl.openDocument
l = fl.swfPanels.length;
if (l == 0) return 'false';
for (i=0; i<l; i++){
if (fl.swfPanels[i].name == p_panelName) return (p_param == null) ? fl.swfPanels[i].call(p_function) : fl.swfPanels[i].call(p_function, p_param);
}
return 'false';
}
call_method('gProject', 'runCompileList');
This is wonderful my man and its working smoothly except for one thing. If you have several .as scripts open in Flash CS5 and you hit the shortcut to "Test Project" it doesn't first save all of your .as scripts before compiling. This was a wonderful effect that we overuse here and was quite disappointed with Adobe left it out for CS4 & CS5. Is there a way to add code to the .jsfl that will save all .as scripts before testing the project?