Content

Bill Gates Touched My Mac Book Pro

ASExpander updates

Monday 3 November 2008 - Filed under Extensibility + Flash

Having too much fun with this.

* Changes:
* 1.1 Started using actionsPanel.getText, setText. And setSelection for cursor position.
* 1.1.1 Fixed a typo in enterFrame
* 1.1.2 Not correctly finding end of file if no cursor specified. So specified cursor at end of each snippet. Added some snippets.
* 1.1.3 Added help function. Type &help and run command and it traces out a list of commands.

http://www.bit-101.com/extensions/ASExpander.jsfl

Background in case you’re seeing this for the first time:

http://www.bit-101.com/blog/?p=1620
http://www.bit-101.com/blog/?p=1627

2008-11-03  »  keith

Talkback x 14

  1. Florian
    3 November 2008 @ 10:40 am

    Thanks! I’ll try it later …

  2. James Thompson
    3 November 2008 @ 2:03 pm

    You’re edits have made it look almost identical to mine :) I was searching for ** instead of &cursor. I’m about to go home and will probably be playing around with this all evening!

  3. kp
    3 November 2008 @ 2:11 pm

    Cool. I welcome any further suggestions.

  4. James Thompson
    3 November 2008 @ 5:50 pm

    I’ve made an “Add To ASExpander” script, which is working great except for the predictable problem of escaping newline and tab characters. The idea is that you select some text in the actions panel, then run the command. It prompts you for a key, and then adds it to the ASExpander.jsfl file. I am thinking along the lines of key.split(“\r”).join(“\\r”), but that’s not working. Here is the script, which is working fine if you manually enter \n and \t:

    var ASExpanderFile = FLfile.read(fl.configURI + “Commands/ASExpander.jsfl”);
    var selectedText = fl.actionsPanel.getSelectedText();

    if(selectedText == “”){
    alert(“Please select a snippet to add to ASExpander.”);
    } else if(ASExpanderFile == “”) {
    alert(“Unable to find ASExpander.jsfl in:\n\n” + fl.configURI);
    } else {
    var key = prompt(“Please enter a key for the selected snippet.”);
    if(key != null) {
    FLfile.write(fl.configURI + “Commands/ASExpander.jsfl”, ASExpanderFile.split(“map = new Object();”).join(“map = new Object();\nmap[\"" + key + "\"] = \”" + selectedText + “\”;”));
    fl.actionsPanel.replaceSelectedText(“”);
    }
    }

  5. James Thompson
    3 November 2008 @ 6:09 pm

    PS – I guess it should be if(key != null && key != “”) instead of just if(key != null) – so that both entering an empty string (“”) and pressing cancel (null) are not accepted.

  6. Antheor
    4 November 2008 @ 6:57 am

    The Add to ASExpander is definitely a good idea. I miss something on the usage : your code goes in a .jsfl and acts as a command ? I did that and encoutered some errors. Could you tell me more ?

  7. James Thompson
    4 November 2008 @ 12:47 pm

    Yes, I have an ‘ASExpander – Add Snippet.jsfl’ file with that code it. What errors do you get? I’ve posted the file here just in case posting it to the blog has mucked up the code:

    http://www.jamesthompsondigital.com/developers/bit-101/ASExpander – Add Snippet.jsfl

  8. James Thompson
    4 November 2008 @ 2:40 pm

    Okay. I have pieced together a more complete jsfl command. I can’t say that I have thoroughly tested it, but it is working so far for me. Here are its features:

    * Select text in the actions panel and run command to add a map (you will be prompted for a key).
    * Automatically escapes newline, tab and quote characters.
    * Enter an already used key, and you will be asked if you would like to use the selection to replace the old map.
    * Select the word “delete” and enter an already used key and you will be asked if you want to delete the key.

    I don’t know if “Add Snippet” is still the best name now that it can add, edit and delete maps, but here it is:

    http://www.jamesthompsondigital.com/developers/bit-101/ASExpander_-_Add_Snippet.jsfl

    Just replace the underscores with spaces once it has downloaded and give it a better name if you can think of one :)

  9. Antheor
    4 November 2008 @ 3:57 pm

    It works like a charm now !

  10. Actionscript 3, フレームアクション入力で楽したい | イナヅマtvログ
    4 November 2008 @ 8:37 pm

    [...] ASExpander 1.1.3 タイポ、カーソル位置のバグフィックス、コマンドを追加。 ASExpander updates &help &sprite &mc &tf2 &tf Actionscript3 ASExpander, snippet « [...]

  11. TimK
    6 November 2008 @ 3:59 pm

    Hi everyone,

    For a while now my Flash CS3 has not been showing any additional jsfl scripts that I am adding to the Commands folder. Its really getting on my nerves. I’ve written some custom scripts too, and the only way I can run them is to open up the Commands folder and double-click the script file. Has anyone else had this issue where new commands don’t show up?

    Yes I’ve restarted both Flash and my computer. Yes I know where the commands folder is. Is it possible that there are two commands folders, like one in Documents & Settings that I can’t find?

    This is annoying!

  12. kp
    6 November 2008 @ 4:11 pm

    Tim, yes, there are a few Commands folders. The one you are looking for is:

    Mac: /[user]/Library/Application Support/Adobe/Flash CS3/en/Configuration/Commands
    Windows: \Documents and Settings\username\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\

  13. kp
    6 November 2008 @ 4:11 pm

    James, haven’t tested out your add snippet command. But it looks cool. Thanks for contributing.

  14. localToGlobal » Blog Archive » news review -> 45th week of 2008
    7 November 2008 @ 12:16 pm

    [...] > ASExpander updates | BIT-101 Blog [...]

Share your thoughts

Re: ASExpander updates







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>