Fireworks & Flash Panel Wrapper Code

Make Flash Panels? Sick of MMExecuting your coding life away? Check these wrapper scripts. I originally thought that the API that came with the FWCommandComponents would be my salvation… but it took more than a day and a lot of favor asking, which I hate doing btw, to get them. Thankfully, a fellow developer came through… after I had written my wrapper out of frustration…well, really lack of patience to be more accurate. See, the Extending Fireworks PDF claims that there is this aforementioned MXP on the Studio MX CD or on the website. I thought it meant the Studio MX 2004 CD, hence no one finding it, except for one developer who thought to check the MX one. It’s not on MM’s website.

At any rate, it turns out after installing, the homes who wrote it practically wrote a Flash wrapper function for EVERY Fireworks JSF command possible… pretty insane. My route was totally different. I just used resolve with a little string mods, and some AsBroadcaster since EventBroadcaster became tedious as hell that forwards the window panel events that Fireworks generates to whatever listener cares.

Bottom line, instead of this:

MMExecute(“fw.exportSWF();”);

You can do this right in Flash:

fwapi.exportSWF();

Feels good, don’t it?

Well, I’ve liked more of what Fireworks offers in terms of events, but still, I do do (gross) some occasional Flash Panel work too, and there has been an influx of more JSAPI/JSFL and Flash Panel developers releasing tools, so figured it was a great time to port it over to Flash too. I’ve included a sample with the Flash one, while the Fireworks one is in my previous post, the PNG to SWF Batcher. Both FLA’s in the source file utilize the AS class wrapper and use it, hopefully enough to give you an idea of how it works.

Weaknesses are, when returning complex values, like doc from getDocumentDOM for instance, your still better off doing multiple lines of code in a big string, and executing that, or just running an external script. Also, I don’t convert Boolean’s that are returned, so they’re still “true” and “false” as strings. Still, numbers and strings work great.

Now, before I get my ass kicked for not using AS2, here me out: which would you rather use? This:

import FWAPI
#include “JXLFWAPI.as”

And it HAS to be in that order, or:

#include “JXLFWAPI.as”

And just one file?

Thought so. If you said the first, your a goob, and just want to see me get all ticked off… well GIVE UP GOOBER!

__resolve is neato.

Fireworks Flash Panel Wrapper – <a href=”https://www.jessewarden.com/downloads/JXLFWAPI.as”>JXLFWAPI.as</a> | <a href=”https://www.jessewarden.com/downloads/pngtoswf_source.zip”>Source</a>

Flash Flash Panel (whoa) Wrapper – <a href=”https://www.jessewarden.com/downloads/JXLFLAPI.as”>JXLFLAPI.as</a> | <a href=”https://www.jessewarden.com/downloads/flashpanelwrapper.zip”>Source</a>

10 Replies to “Fireworks & Flash Panel Wrapper Code”

  1. Nice work! Just downloaded it and tested. One thing: the example FLA is set to publish to YOUR WindowSWF directory – no biggey.

    __resolve is sweeet!

    Also:
    if(_global.FLAPI == null){
    _global.flapi = new jxl.flash.FLAPI();
    }
    Shouldn’t it be lowercase flapi in the conditional? Or uppercase in the instance. Just for strict-type’s sake.

    I’ve been working on some panels so this should come in real handy – thanks!

    Derek

  2. WOW I like this some much, it’s very usefull.

    I have seen that the FW code have also some events functions, how these works?

    I have 2 suggestions:
    – also Dreamweaver can have Flash panel, why don’t make also a DW version?
    – maybe for better reuse the code will be better to have only a single wrapper and use something like: jsapi.myFunction().

    Daniele

  3. Derek, geez, I totally forgot the Publish settings… I’ll fix that and the case problem. Thanks a lot for the feedback!

    Daniele, yeah, wasn’t Dreamweaver like the first? Cool, if it’s just about the same, then I’ll definately make one, but your suggestion about consolidating it into one is probably better. Hrm… currently, I don’t see any reason why it’s NOT better; cool, I’ll see what I can do. Thank you too for the feedback!

  4. The events that Fireworks fires off are in the Extending Fireworks PDF. Basically, when you change a document or some settings, or close the window SWF, you get events from fireworks. You can have anyone, save _root, register for those events like so:

    fwapi.addListener(myListener);

    So, if you want to know when the window closes:

    b = {};
    b.owner = this;
    b.onFwStopMovie = function(){
    var so = SharedObject.getLocal(“prefs”);
    so.data.w = Stage.width;
    so.data.h = Stage.height;
    so.flush();
    };
    fwapi.addListener(b);

  5. The only reason why I want to keep the Fireworks and Flash wrappers seperate is in the case of changes to events that are broadcast. Like, Fireworks Panels currently get events from Fireworks while Flash ones don’t… yet.

    And when they do, they will probably be differently named.

  6. Hi Jesse,

    Is there any reason you removed the Fireworks and Flash wrappers?

    Would it be possible to get them off you.

    Thanks,

    James

  7. Contratulations on the new addition to your family!

    I was wondering if you could replace the broken links to your Flash wrapper. The /archives/fireworks directory has your fireworks API, but the Flash one is still missing.

    Thanks!

Comments are closed.