8 Replies Latest reply on May 25, 2010 4:01 AM by Yateam

    How to combine WipeLeft and RemoveChild?

    Yateam

      Hi all,

       

      I have a situation: I want to remove a child from the container which should be set unvisible then. Setting the container unvisible has hideEffect - WipeLeft. and removing a child has removeEffect - WipeUp. So how can I remove a child with WipeUp effect right before hideEffect (WipeLeft) starts? I tried to handle 'effectStart(hideEffect)' event but it could not help me.

       

      Sorry for probably very bad english

        • 1. Re: How to combine WipeLeft and RemoveChild?
          BhaskerChari Level 4

          Hi,

           

          Its not possible to play both these effects simultaneously why because if you say first removed the child by using removeChild method then WipeUp effect plays and after that effect you don't have the container visible in the UI and you cannot play your WipeLeft effect(by making invisble).

           

          Do u wanna play both these effects simultaneously...?

           

           

          Thanks,

          Bhasker Chari

          • 2. Re: How to combine WipeLeft and RemoveChild?
            Yateam Level 1

            No, not simultaneously. First, child should wipe up, then container itself should wipe left, right after child was removed (wiped up).

            • 3. Re: How to combine WipeLeft and RemoveChild?
              BhaskerChari Level 4

              Hi,

               

              Paste this code and run the application....Hope this is what you need...

               

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                  <mx:Script>
                      <![CDATA[
                         
                          private function hideContainer():void
                          {
                              container.visible = false;               
                          }
                          private function removeCanvas():void
                          {
                              container.removeChild(myCan);   
                          }
                      ]]>
                  </mx:Script>
                  <mx:Canvas id="container" hideEffect="WipeLeft" width="400" height="400" backgroundColor="gray">
                      <mx:Canvas id="myCan" effectEnd="hideContainer();" removedEffect="WipeUp" width="300" height="300" backgroundColor="red" horizontalCenter="0">
                      </mx:Canvas>
                      <mx:HBox top="350" horizontalCenter="0">           
                          <mx:Button id="btnRemove" label="CLICK ME" click="removeCanvas()"/>
                      </mx:HBox>
                  </mx:Canvas>
                 
              </mx:Application>

               

              If this post answers your question or helps, please kindly mark it as such.

               

              Thanks,

              Bhasker Chari

              • 4. Re: How to combine WipeLeft and RemoveChild?
                Yateam Level 1

                Thank you, Bhasker Chari.

                 

                That looks like what I need. I meant such behavoir. But there is one problem: 'container.visible = false' should be called outside the container. So, all WipeLeft and WipeUp effects should be played during 'container.visible = false' phase of code. The container has its own 'hide' behavoir and outside caller knows nothing about it. That is the most difficult part for me.

                • 5. Re: How to combine WipeLeft and RemoveChild?
                  BhaskerChari Level 4

                  Hi,

                   

                  I din't get your problwm exactly if you post your code that reproduces your problem...I can help...you

                   

                   

                  Thanks,

                  Bhasker Chari

                  • 6. Re: How to combine WipeLeft and RemoveChild?
                    Yateam Level 1
                    <?xml version="1.0" encoding="utf-8"?>
                    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                              <mx:Script>
                                        <![CDATA[
                                                  import mx.events.FlexEvent;
                                   
                                                  protected function button1_clickHandler(event:MouseEvent):void
                                                  {
                                                            container.visible = false;
                                                  }
                    
                                                  protected function container_hideHandler(event:FlexEvent):void
                                                  {
                                                            container.removeChild(myCan);
                                                  }
                    
                              ]]>
                         </mx:Script>
                              <mx:Canvas id="container" hide="container_hideHandler(event)" width="400" height="400" backgroundColor="gray">
                                        <mx:Canvas id="myCan" width="300" height="300" backgroundColor="red" horizontalCenter="0">
                                        </mx:Canvas>
                                        <mx:HBox top="350" horizontalCenter="0">            
                                                  <mx:Button id="btnRemove" label="CLICK ME" click="//removeCanvas()"/>
                                        </mx:HBox>
                              </mx:Canvas>
                              <mx:Button click="button1_clickHandler(event)" />
                    </mx:Application>
                    

                     

                     

                    That is the correct behavior, but proper effects should be added.

                    • 7. Re: How to combine WipeLeft and RemoveChild?
                      BhaskerChari Level 4

                      Hi,

                       

                      This is not the correct way of using both the effects on the same container.....if you apply both the same effects on the same container say you want the WipeUp efffect should be played first that means the container is already removed after the effect is played then how can you view the WipeLeft after the WipeUpp effect since the container is already removed...you cannot see the WipeLeft..

                       

                       

                      Thanks,

                      Bhasker Chari

                      • 8. Re: How to combine WipeLeft and RemoveChild?
                        Yateam Level 1

                        Well, first I see how 'myCan' is removed (with WipeUp) and then I see 'container' is set unvisible. I need 'myCan' is removed somehow just before 'container' hides.