Komodo development

Categories:Komodo

Managing your scripts

The easiest way to manage your files is using Komodo's Projects panel. xJSFL comes with a default Komodo project, with 3 folders, core, modules, and user.

You can add your own scripts to the user folder if you wish or you can create your own Komodo Project elsewhere on your hard drive if that suits you better. If you develop any Modules you'll end up building sets of related files in a modules subfolder.

Writing and running your first JSFL script

You'll need the Komodo xJSFL Extension installed to run scripts, so make sure it is then:

  1. Create your first script by pressing CTRL+N, or by going File > New > New File
  2. Write any valid JSFL in the file, then save it with a .jsfl extension
  3. With Flash open, press CTRL+Enter to run the file

Initializing the framework

Due to the way Flash sandboxes externally-run files (i.e. from Komodo) you'll notice that variables created in one execution, won't exist in subsequent executions. This is different from running scripts via the Commands menu, or running them in Flash Panels.

What this means for xJSFL and running code from an external IDE is that a clever workaround is needed in order to not reload the entire framework from disk on every external script execution. In this case the workaround is that when xJSFL loads, all framework code is copied to the xJSFL extension, and a special method xjslf.init() is called to copy the code back out to the currently-running script environment.

So, this means when writing JSFL code that relies on the xJSFL framework, every script needs to call xjsfl.init(this) before executing any JavaScript that relies on xJSFL functionality:

// copy framework code to current scope
    xjsfl.init(this);

// run your code
    inspect(window);

Next steps

4 Responses to Komodo development

  1. Chelsea Hash says:

    Does anyone know what would influence whether or not the ctrl+enter to execute code in flash will work?

    When I first completed the installation and set up this worked flawlessly. However after doing other things for an hour I’ve come back and hitting ctrl+enter (with flash definitely open and ctrl+enter definitely enabled in preferences) I get “Running JFSL script “test.jfsl” notice – but flash doesn’t catch the call. The stripped down test is as above:

    xjsfl.init(this);
    alert(‘test!’);

    The first time I ran this I got the alert pop-up in flash no problem. I’ve tried restarting my computer, restarting flash and komodo, opening them in different orders and re-installing to no positive result. I’m beginning to thing seeing it work originally was just my imagination. Any recommendations on what might be the cause?

  2. Dave Stewart says:

    Hey there, sorry for the delay in replying.

    I’ve no idea, actually. Sorry. That does sound a bit weird. My suggestion would be to uninstall and reinstall the plugin. If you want to Skype me to screenshare and walk through the issue, go ahead. Just enter dave /at/ xjsfl /dot/ com into skype and I should pop up

  3. Kelsey Mott says:

    This looks like an awesome solution for JSFL dev. Unfortunately having trouble with finding the right combination of versions for Komodo/xJSFL/AutoCode.

    I’ve tried installing a couple versions of Komodo 7 (7.0.0 and 7.0.2) as well as Komodo 8.5 and xJSFL doesn’t appear to be compatible with them.

    Hoping to get a little help on the best version for this.
    Thanks!

  4. Dave Stewart says:

    Kelsey, I’ve dropped you an email as it sounds quite specific. Cheers, Dave

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>