Multiple windows in AIR: Removing mediators

Thomas Troelsen's Avatar

Thomas Troelsen

08 Jun, 2011 12:33 PM

Hi!

I have a question about multiple windows in an AIR application. I understand that I need to register mediators manually for components in the secondary window.

http://knowledge.robotlegs.org/discussions/problems/87-spark-graphi...
http://knowledge.robotlegs.org/discussions/problems/50-mapping-medi...
http://knowledge.robotlegs.org/discussions/questions/50-best-place-...

Now my scenario is, that I will create a GUI window where the elements won't change during runtime. So these elements will be placed in the secondary window as they are easy to mediate manually.

In the primary application window a tons of components will be added and removed during runtime, so I need to absolutely sure that mediators are cleaned up when removed to prevent memory leaks. Therefore I want to use the automatic mediation in the main window.

1) The following test seams to work, but can you confirm that the automatic mediation will clean up the main application window automatically, as long as I clean up the secondary window when removing components?

2) Do you have any experience if performance in the main application window is reduced when running a windowed application, instead of keeping all GUI content and application content in the same window?

3) Is it correct that manually created mediators are initialized before automatic created mediators, or is it just in this specific case (see trace output)?

Thanks for Robotlegs!

Best regards
Thomas Troelsen

        // map views with mediators
        mediatorMap.mapView( WordCmp,       WordMdt ); //<- this is an UIComponent
        mediatorMap.mapView( ViewportCmp,   ViewportMdt ); //<- this is a spark.Window

        // setup viewport
        _viewport                   = new ViewportCmp(); //<-creating spark.Window
        mediatorMap.createMediator(_viewport); //<- manually create mediator, as it is not part of main context

        // creating content
        var word01:WordCmp = new WordCmp("word one"); //<- just a normal UIComponent
        var word02:WordCmp = new WordCmp("word two"); //<- just a normal UIComponent

        // adding a compoenent to main window and a component to the secondary window
        contextApp.addElement( word01 ); //<- to main window, application
        _viewport.addElement( word02 ); //<- to secondary window

        // manually create mediator for windowed components
        mediatorMap.createMediator( word02 ); //<- manually create mediator for component in secondary window

        trace("init done");

By tracing the objects, the following output results in console:

        [SWF] EntryPoint.swf - 2,203,196 bytes after decompression
        init done
        word added! ViewportCmp8.WindowedApplicationSkin9.Group10.contentGroup word two
        word added! EntryPoint0.WindowedApplicationSkin2.Group3.contentGroup word one
        window regged
        window open
        [Unload SWF] EntryPoint.swf
  1. Support Staff 1 Posted by Ondina D.F. on 22 Jul, 2011 12:58 PM

    Ondina D.F.'s Avatar

    Hi Thomas
    Just wanted to let you know, that, for some reason, there was a spam filter issue on the robotlegs forum.

    That’s why a few posts were visible on the list, but couldn’t be opened, therefore they got no answers.

    Your post was one of them.

    Stray (from the Support Staff) has fixed the issue.

    Hopefully it’s not too late for you to get your question answered.

    Ondina

    P.S. And now, after writing the same message twice, I feel like a robot ;)

  2. Ondina D.F. closed this discussion on 02 Nov, 2011 05:39 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac