JSFL makes me bang my head on the desk sometimes. Don’t get me wrong, JSFL is useful. I’ve been using it for some time now to partially automate builds for Flash CS3 FLA–based components. I can create component shims, live preview SWFs, and many things of that nature which normally take a long time to do manually. Unfortunately, I can’t get everything working perfectly for a fully automated build. Here are a few problems with JSFL that have been making me extra angry:
-
library.updateItem("itemName")
Crashes Flash CS3This works like the Update… option that’s available when you right-click on something in the library. Basically, it lets you update your symbols from a source FLA. This is useful for component examples that need an updated component symbol from the main FLA. Apparently,
updateItem()
worked well in Flash 8, but calling it brings the whole application down in Flash CS3. A topic about the crash on the official Flash forums includes a response from someone at Adobe that says that this bug has been fixed and will be included in the “next release”. Will this be an update to Flash CS3, or are we talking CS4? -
Copy an Item from one FLA’s library into another FLA requires confirmation
As a workaround to the
updateItem()
bug, one can add a symbol from the source FLA’s library to the stage of the destination FLA. This will replace the out-of-date symbol in the destination library, but it displays a confirmation dialog that you have to interact with manually.Several other JSFL functions have flags to let you bypass dialogs like this (such as the
bPromptToSave
parameter used byfl.closeAll()
), butdocument.addItem()
does not. -
Component Live Previews cannot be set or updated with JSFL
FLA-based components need a live preview SWF embedded in the FLA to have the component appear properly on stage when the user drags it there. As I mentioned, I can easily create that SWF with JSFL, but making my component use (or later update) that SWF is another story.
To manually update the live preview SWF, you have to right click on the component, go into Component Definition…, click the Set.. button in the live preview section, click the Update button, click OK in one window, and then click OK in the next. There is no API to set or update it with JSFL, and all that clicking leads to long builds.
Hopefully, some of these things can be cleared up in Flash CS4 (or maybe a CS3 hotfix for that crash bug, please?). In theory, it will be possible to modify and create files using the upcoming XML/ZIP FLA file format called XFL completely outside the Flash authoring environment. It doesn’t help me now, but I rest just a little bit easier knowing that I’ll have an easy job creating builds in the future when XFL becomes available and I may no longer need most of my JSFL scripts. Adobe, want to make things just a tiny bit easier? I’d love for Flash CS4 to include a native command-line compiler to build FLA files. I already run Flash from the command line now, but I’d rather not have the whole IDE open when I don’t need any visual tools.
The biggest thing I miss in JSFL are events. I’d like an event to know when the library has been opened, when new docs are opened, when a new clip is added to the library, when the tab for the FLA is changed etc.
I love to see it classes based and a consistent language across all Adobes products.
Hi Josh,
I love the yahoo as3 api’s and components! (In fact, I grew up on yahoo, and later migrated to google, but since I love all things as3 I find myself coming home..:) ) Anyway, I want to suggest that there is a real need for a well developed set of e-learning components for as3, complete with good documentation and an easy interface to the SCORM api. It appears that adobe didn’t update their as2 elearning tools in flash for as3.
And that seems bizarre because there seems to be great potential for elearning development with flex. Maybe there are some resources I’m not aware of, but I want to suggest that the yahoo flash team could have an enormously positive impact here. Just imagine the possibilities for integrating elearning components with the yahoo web services and scorm assessment!
Thanks,
Jason Aubrey
I’m still using version 8 and the fact that I can’t easily copy items from library to another with jsfl is brutal. Even more brutal is that I find this page telling me that this still hasn’t been fixed in CS3. Booo… Adobe has many talented people, I’m sure that there are good things to come.
Regarding “COPY AN ITEM FROM ONE FLA’S LIBRARY INTO ANOTHER FLA REQUIRES CONFIRMATION”, I’ve struggled with this issue for a while now and have finally found a workaround IF you are ok with your library items being in a folder.
1. Put your library item in a folder
2. Use the trick you described above of adding the item to the stage. The item will be added to the library at the top level, so it will not conflict with the one in the folder.
3. Use library.moveToFolder(folderPath [, itemToMove [, bReplace]]); Setting the bReplace flag to true will replace update the item without a confirmation dialog!
4. Delete the item from the stage
Maybe I’m too late to save you, but someone else may benefit.
Cheers!