-
-
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'); |
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');
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