1 Reply Latest reply on Mar 5, 2012 8:28 PM by Sathyamoorthi

    How to detect when a component is "displayed"?

    mob_eng_at_edt Level 1

      Many times we need to fire off some animation a few hundred millis as soon as a component is displayed on the screen, but not before. 

       

      Maybe I am missing something obvious, but we cant seen to find an event that actually fires off after the screen is displayed and has completed rendering.

       

      creationComplete doesent work if the component was previously created, so we cant depend on that since that is sometimes the case that the componet was previously created.

       

      We need some event like "componentDidFinishRendering" that we can use as a que to start the animation.

       

      What is the recommended way to handle this situation?

       

      We want to set a component to visible and fire an animation off once the component has finished rendering and is essentially visible to the user.

       

      Thanks for any help!

       

      Bob Hays

      EDT, Inc.

        • 1. Re: How to detect when a component is "displayed"?
          Sathyamoorthi Level 2

          i usually do this in lot of ways.

           

          1.i tried with creationCompleteEffect.

           

          2.if that not works, then i try showEffect.

           

          3.sometimes components are added in actionscript and size may be set after your effect.

           

          in that case,i added updateComplete for that component.and play effect there. but be sure, you should remove update complete event listener. something like this.

           

          var com:com = new com();

           

          //properties here.

           

          parent.addChild(com);

          com.addEventListener("updateComplete", UCH);

           

          private funciton UCH():void

          {

               com.removeEventListener("updateComplete", UCH);

               //playEffect.

          }