0 Replies Latest reply on Jan 26, 2012 9:42 PM by DavidHertz

    ViewActivate event and multitask problem (iOS)

    DavidHertz

      Hello!

      Somebody can tell me how i can do for avoid re-execution of "viewActivate" event when i press home and return to application (with multiasking option)??

       

      For example: I have the next view (code) on ViewNavigatorApplication:

      ________________________________________________________________

      <s:View

              xmlns:fx="http://ns.adobe.com/mxml/2009"

              xmlns:s="library://ns.adobe.com/flex/spark"

              viewActivate="init()">

       

       

      <fx:Script>

              <![CDATA[

       

                  [Bindable]

                  private var menuAC:ArrayCollection = new ArrayCollection();

       

       

                  protected function initView():void

                  {

                      //menuAC = new ArrayCollection();  --> This can be a solution, but really i wanna know if exists other one.

       

                      menuAC.addItem({label:"One"});

                      menuAC.addItem({label:"Two"});                   

                  }

      ________________________________________________________________

       

      The problem is if i suspend the application (pressing home button) staying on a view and after return to it, the 'viewActivate' event is triggered for these view, and for this example my 'menuAC' is now  a four elements array (with the first and seconds twice).

      Really this is a basically example, i can resolve it creating a new intance on the initView method, but the problem is when i have a lot of sentences than i dont want to re-execute and instanciate again. :s (i can't create a new instances every time).

       

      Thanks for all and sorry for my little english

       

      Saludos!!