Default application when running flash script directly

When you right click a .as file in a module and choose "Run '<scriptname>'   Ctrl-Shift-F10", you seem to have no control over what application is used to execute the resulting .swf file.

Is there a way to choose what application should be run in this case?  If not it woudl be great if there was one.  Note that this is NOT the same as the "Run/Debug configurations".

Under my Gnome-based linux distribution it constantly launched totem, independent from what I had configured as the .swf default in Nautilus.  In the absence of finding a way to change the application IDEA chooses to launch, I dug into it and found this post which revealed that IDEA uses java's getDesktop to figure out what to run.  Digging further, for linux this uses Gnome functions to figure it out.

After much further digging, I came up with a solution/hack that works for me, and hopefully helps someone else.  Here's how (with some explanation):

If you look in '/usr/share/mime-info/gnome-vfs.mime' you will see that .swf files are tagged as the 'application/x-shockwave-flash' MIME type.  grepping for this in /usr/share/applications I saw the root cause of the totem infatuation:

application/x-shockwave-flash=totem.desktop


What you need to do is make a replacement application for Gnome to use.  This can be overridden for the local user.  First, you need to make a new application type with the following console command:

gnome-desktop-item-edit ~/.local/share/applications/ --create-new


I then ran 'xdg-user-dirs-update', although I don't know if that did anything (it seemed relevant).

Then you need to make the local association.  To do this, add this line to '~/.local/share/applications/defaults.list':

application/x-shockwave-flash=flashplayerdebugger.desktop


where in my case when I made the new Gnome application I called it 'flashplayerdebugger' and pointed it at the same.

After restarting IDEA, direct script running now works, as does debugging since I set it to the debugger version of the player.

Hopefully this helps someone else, too.

6 comments
Comment actions Permalink

When you launch *.as file from context menu (or Ctrl-Shift-F10) IntelliJ IDEA looks if there's any existing Flash App run configuration with this *.as file as main class and launches it.
If there is no suitable existing run config then new Flash App run configuration is created. New run configurations are created basing on defaults which are editable.

So if you want that all newly created Flash App run configurations are launched in the browser by default or with some Flash Player you need to edit defaults: open Run | Edit Configurations... dialog, expand Defaults node, find Flash App there, select any Web-targeted Flash build configuration there and change the value of 'Launch with' option.
In this case all newly created run configs will have desired 'Launch with' option.

Note that the fact that you have selected some build configuration as a default - it doesn't change anything, because in any case when new run configuration is automatically created - build configuration is taken from context, but not from defaults.

0
Comment actions Permalink

AlexanderD wrote:

When you launch *.as file from context menu (or Ctrl-Shift-F10) IntelliJ IDEA looks if there's any existing Flash App run configuration with this *.as file as main class and launches it.
If there is no suitable existing run config then new Flash App run configuration is created. New run configurations are created basing on defaults which are editable.


Ah... for whatever reason I did not see the automatically generated run configuration.  Thanks for pointing that out.

I now have a follow-up question... the reason for me doing the direct script running is that I have set up an "experiments" group in the project with the intent of holding a large number of one-shot scripts, where each script is a single experiment resulting in a single swf that is not to be part of the released project (but is project relevant so shoudl be grouped in the project).  I thought the ctrl-shift-f10 context launch method woudl be a clean way of doing this, but if I'm going to end up with a run/debug configuration for every single file it will be less useful.

Is there a way to generate such a group of one-shot swf files in a project without having a run/debug configuration per file?  It seems like any 'run' operation is going inescapably generate a persistent run/debug config.

0
Comment actions Permalink

I don't see any problems with these temporary auto-created run configurations. They are stored in workspace.xml file which is not intended to be kept under VCS. And you can limit the amount of such auto-created temporary run configs (see screenshot attached)



Attachment(s):
Untitled.png
0
Comment actions Permalink

AlexanderD wrote:

I don't see any problems with these temporary auto-created run configurations. They are stored in workspace.xml file which is not intended to be kept under VCS. And you can limit the amount of such auto-created temporary run configs (see screenshot attached)


The fact that they are temporary and limitable is perfect.  Thanks, Alexander!

0

Please sign in to leave a comment.