importXML Extension for Flash MX 2004 IDE
Get my new importText extension with more features: MXP (it
includes the features of this importXML extension)
How to get it
grab the .MXP (33k) version 1.1
How to install it
Use the Macromedia Extension Manager (If you don't already have
it from your Flash IDE install then you can grab it here: Macromedia
Extension Manager)
This is only for Flash MX2004 version 7.2 or above
How to use it
Launch the Flash MX 2004 IDE and then Windows>Other Panels>importXML
You
can dock or undock it just like any other panel in Flash..

What it does
You pick the XML file you wish to import
You set the name of the variable that the XML string will be assigned to
When you click the Import XML button:
- All tabs and carriage returns are stripped out of the XML
- All double quote characters are escaped (so " is replaced with \"
)
- The resulting XML string is inserted into the Actions panel (layer
1, frame 1) of the currently opened document.
- The file name and variable name are saved into the Local Shared Object
as the defaults, and they are saved as data into the FLA so they
will be available the next time the FLA is opened.
* I couldn't figure out a good way to detect when the user changes documents,
so there's a "refresh" button that will load the filename and variable
name for the current document.
WHY is this needed?
One of the weaknesses of the Flash IDE is that there's no way to import XML documents
at compile time and embed them into the SWF. Granted this isn't something
most people need to do, but if your projects involve embedding XML into the
SWF then this can get to be a bother.
Basically the standard workaround is to take the XML document and convert
it into a name/value pair so that the XML becomes a string and the name/value
pair can then be pasted or #included into the Actions panel. The problem
with this is it's time consuming, and you end up with a bunch of mangled "XML" files.
They are no longer valid XML documents. I wrote a small Central application
that automated the process, but it still didn't get what I wanted.
Flash 7.2 added some new file I/O features to JSAPI and I was finally
able to do what I wanted..
Reporting bugs/feature requests/thanks
Go to the contact page and send me an e-mail.
I give no guarantees that I'll respond, fix the bug, or add the feature,
but I'll try.
updates:
7/28 - v1.01 - fixed a tiny bug that was trying to load data from the
FLA when you first opened Flash. (MMExecute('fl.getDocumentDOM()')
doesn't return null.. it returns "null".. silly me.
|