Skip to content

Instantly share code, notes, and snippets.

@chrisyour
Created November 4, 2010 17:15
Show Gist options
  • Save chrisyour/662796 to your computer and use it in GitHub Desktop.
Save chrisyour/662796 to your computer and use it in GitHub Desktop.
Flash CS4/CS5 Project Panel: "Test Project" Keyboard Shortcut
// # 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');
@lestat1124
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment