XML to UI Examples

Sharon Selden from Macromedia was responding to our increased interest in using XUL, an XML language used to create forms. There are some tag definitions on the net, but it was nice to get documentation and examples from the source. Additionally, she posted some XUL to UI examples, but the list didn’t allow attachments, so I’m hosting them for da group.

…however, there were a few of us that had tried to use JSAPI with them, and met with little success in actually having JavaScript ‘esque control like you do in HTML pages. I had managed to populate some controls, but the jsfl runs in a scope that is different from your document, so there’s really no way to get data back from the XUL form… at least that I found. Muzak posted this link, but I haven’t had time to read the whole thing to see if it solves the whole thing. Hopefully I can find my answers in da zip I just uploaded. Regardless, XUL is sooo much frikin’ easier than a Flash panel… until you want to populate controls. We’ll see.

Muzak’s link to a good XUL reference

Sharon’s post of XML to UI Tags via LiveDocs

Sharon’s XUL to UI Examples

XML to UI Examples – ZIP

4 Replies to “XML to UI Examples”

  1. Hi Jesse,

    Thx for hosting the zip.
    I’ve been struggling with the same problem. Communication between a XUL dialog and JSFL.
    There seems to be a difference between calling a XUL file from a JSFL file and the other way around regarding getting/setting values in the XUL dialog.
    When you open a XUL dialog using JSAPI, as in:
    var xui = fl.getDocumentDOM().xmlPanel(fl.configURI + “Commands/xul-dialog.xml”);
    That’s about all you can do (as far as I know). The rest has to be taken care of from inside the XUL dialog. Meaning, you then have to/can invoke functions inside a .jsfl file (and it doesn’t have to have the .jsfl extension by the way).
    The JSFL file that launched the XUL dialog only reacts to the closing of the dialog and passes a ‘dismiss’ property with either an ‘accept’ or ‘cancel’ value.

    if(xui.dismiss == “accept”){
    fl.trace(“user clicked OK button”);
    }
    if(xui.dismiss == “cancel”){
    fl.trace(“user clicked CANCEL button”);
    }

    And you can then retrieve property values from the XUL dialog using:
    xui.propertyName

    From within a XUL dialog you can invoke functions inside a JSFL file, which of course allows you to pass on arguments, using:

    fl.runScript(filename, functionName, arg1, arg2);

    Inside the function being invoked, you can then get/set property values from the XUL dialog using:

    fl.xmlui.get(“propName”);
    fl.xmlui.set(“propName”, “value”);

    Hope this helps.

    regards,
    Muzak

  2. Sorry, it’s late here, and I acknowledge I’m confused, but… what is it that you’re trying to do?

    (I read about “XML to UI” which seemed to imply Flex, then I read “XUL” which seemed to imply Mozilla creating a UI, then I read “JSAPI” which seemed to imply automating the Macromedia Flash MX authoring tool… I’m not getting a clear picture yet, couldn’t restate the desired question for confirmation yet.)

    tx,
    jd/mm

  3. Hi John,

    XML2UI = XUL :-)
    Since there’s no official docs on XML2UI from MM, I think everyone (or is that just me and Jesse – hehe) started to call it XUL as most of the info we gathered comes from xulplanet.com.
    And XML2UI is a subset of (based on) XUL, right?

    And writing XUL is much shorter than XML2UI or XML to UI ;-)

    regards,
    Muzak

  4. Yeah, it’s one of the neat features of Flash MX 2004, where for behavoirs or Window SWF’s, you can create forms using XUL. It’s a lot quicker than creating a Flash form, and then making that SWF talk to JSAPI. The problem is, the JSAPI that you code in the XUL file (xml file) seems to have no way out of it’s scope prison.

Comments are closed.