Re: Views & Mediators life cycle [Questions]

Stray's Avatar

Stray

26 Apr, 2012 01:54 PM

Late to the party, but there are various bugs, including setting buttonMode=true on a Sprite, that cause GC failure in Flash - sounds like this is another one of those!

  1. Support Staff 2 Posted by Ondina D.F. on 26 Apr, 2012 02:32 PM

    Ondina D.F.'s Avatar

    @jimnastiq You’re welcome!

    Not actually a solution, more of a (better ?) workaround:

    Create a custom Button, set the focusEnabled to false and let every button in your app extend this custom button. Of course you’d have to go through the entire code to replace the buttons, but at least you’ll have just one place where you can make changes, for example in case the bug gets fixed (some time in the future….)
    If there was a way to set focusEnabled to false in the command, where you remove the views, before removing them, it would be easier, but I don’t know how.. Maybe you can ask the Flex experts on stackoverflow
    Maybe the Button behaves like this only in a mobile app? If I get a chance I’ll see if it is any different in a desktop AIR app, Flex and pure as3.

    @Stray yeah, sadly the list of bugs just gets longer and longer

    Ondina

  2. 3 Posted by jimnastiq on 26 Apr, 2012 02:57 PM

    jimnastiq's Avatar

    I've made the change on my big project and set all button, buttonbars , ... to false, remove all buttonMode and guess what ?

    My view is still in memory ^
    And profiler is not a real chatterbox ...

  3. Support Staff 4 Posted by Ondina D.F. on 26 Apr, 2012 03:22 PM

    Ondina D.F.'s Avatar

    Last one for today:)

    If the views weren’t mobile Views( ViewOne would be a Group for example), and all the buttons would have the id=“ btnView“, you could do that:

    if (viewModel.currentView)
    (contextView as IVisualElementContainer).removeElement(viewModel.currentView as IVisualElement); var view:ViewOne=new ViewOne();
    view.btnView.focusEnabled=false;
    (contextView as IVisualElementContainer).addElement(view); [Edit] var view:ViewOne=new ViewOne();
    var numberOfElements:int=view.numElements;
    for(var i:int=0; i<numberOfElements; i++)
    {

      UIComponent(view.getElementAt(i)).focusEnabled=false;
    

    }

    (This would be expensive, of course.)

    Not that I like this solution, but…it’s at least something.. isn’t it?;)

    Oh, I just saw your last post. Hmm, strange, it works on my end!
    Does the fxp that I sent you back work?

  4. 5 Posted by jimnastiq on 26 Apr, 2012 03:29 PM

    jimnastiq's Avatar

    Yep it works on the fxp you 've uploaded ! but it seems that another "bug" like the focusEnabled is hanging out in my view but can't find what it is for the moment.

  5. Support Staff 6 Posted by Ondina D.F. on 26 Apr, 2012 03:34 PM

    Ondina D.F.'s Avatar

    Well, without seeing it, it's hard to say what's wrong. Send me the view in question.
    I'm changing the discussion to private, and I'll delete the attached file after I dl it, ok?
    That's all I can do, sorry:)

  6. 7 Posted by jimnastiq on 26 Apr, 2012 03:42 PM

    jimnastiq's Avatar

    Thx for your help Ondina but i quite difficult for me to give you the view (many other component in it).

    I 'll check this by myself ;)

  7. Support Staff 8 Posted by Ondina D.F. on 26 Apr, 2012 03:45 PM

    Ondina D.F.'s Avatar

    No problem at all, and good luck! Don't forget to tell us about the new bugs, so we can add them to our list;)

  8. 9 Posted by jimnastiq on 03 May, 2012 09:42 AM

    jimnastiq's Avatar

    I've finally found the culpice !! It is a buttonBar and the problem is the custom skin i've made ...

    If i remove the skinClass property of the buttonBar on my view, the view is removed properly by th GC, otherwise it remains in memory.

    For the moment i don't find the exact problem in my skin ... still under investigation !

  9. Support Staff 10 Posted by Ondina D.F. on 03 May, 2012 12:21 PM

    Ondina D.F.'s Avatar

    Thanks for the feed-back!

    In my experiments with your code, the buttons didn’t have any styles or custom skins, though they didn’t get gc-ed if the focusEnabled was set to true.

    So, the skins/styles issue you’re describing can be considered to be another “bug”, right?
    How frustrating!

    Have you tried to set styleName = null ?

  10. Support Staff 11 Posted by Ondina D.F. on 03 May, 2012 01:03 PM

    Ondina D.F.'s Avatar

    I meant to say to set styleName to null in a handler of the removedFromStage event, inside the view.

  11. Ondina D.F. closed this discussion on 21 Jun, 2012 08:17 AM.

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