Refreshing Panels in Flash 8

Here at gskinner.com, we do a lot of panel development. For speedier development, we set the publish settings to spit the swf directly into the “Flash MX 2004/en/Configuration/WindowSWF/”directory. This way, once the panel was published once, you didn’t need to move any files, or even leave the IDE — you could simply close and open the panel.

One of the biggest panel development gotchas in Flash MX 2004, was that in order to refresh a panel, you needed to click the “close” button, and not use the right-click/close panel method. Using the latter would keep the panel open in memory, and not reflect changes when it opened.

When Flash 8 dropped, we were excited about the smarter custom swf panels, which detect changes in the swf, and refreshed only when changes were made. This means that no matter how you close the swf, it will not reload unless changes are made. That in itself is great, but a bug in Flash 8 refreshes only the graphics in updated swfs, and not the external classes. This made panel development in Flash 8 impossible. Until today, we had been doing most panel work in MX04, and in the cases where we need to use Flash 8, multiple restarts were necessary.

The solution?

Dock/undock the panel.

We found this totally by accident, but it works! This is the only way to completely refresh the panel, code and all in Flash 8.

Lanny McNie

As the dev mgr, Lanny oversees the technical day-to-day details of production and makes sure things get out the door.

@astrostyle

2 Comments

  1. You can also refresh the panels: select the workspace layout you are currently using (or another if you have more than one) and the panels will be refreshed.

    Pros:

    – updates all panels.

    – if the panel you are testing isn’t part of the layout you choose, it will not be loaded until you select it from the Window menu. This can be a good thing depending on what your panel does out of the gate.

    Cons:

    – updates all panels.

    – if you’ve forgotten to save your current layout … make sure to save your layout.

    Btw, if you test panels a lot I have a tool that might help. It’s a WindowSWF panel that lets you load other SWF files, so you don’t have to work out of the WindowSWF directory, and you don’t have to restart Flash just to add another SWF to the Window menu so you can load it.

    If you find it handy, great. If not, let me know what goes wrong and what you would want different. It’s free:

    http://tracethis.com/downloads/

    And yes, it is succeptable to the issue you mention here. However, in version 1.0.1, it turfs _global.mx so the MM components don’t go ballistic when reloading the SWF.

    I am looking into making it smarter, thanks to your blog 🙂

  2. I just have a Reload button in my panel SWF that does this:

    // clear classes from memory so new code will run when loaded

    delete _global.com;

    delete _global.mx;

    // etc.

    _level0.loadMovie(this._url);

    No need to close/dock panels. Any drawbacks?

Comments are closed.