3 Replies Latest reply on Dec 19, 2010 1:31 PM by Shongrunden

    Strange behavior of Rotate3D

    RaúlKirm

      Hi!, I have these elements in my app:

       

      <s:Rotate3D id="r3d"  angleXFrom="0" angleXTo="20"  />
      ...
      <s:BorderContainer id='contenido' .... >
         <s:Label id='close' click="cerrarFB()" />
      </s:BorderContainer>
      
      
      public function cerrarFB():void{    
          r3d.target=contenido;
          r3d.play();
      }
      

       

       

      The BorderContainer can Drag&Drop. All is ok, when I press the Label 'close', the 3D animation starts correctly.

       

      The problem is when I drag the 'contenido' BorderContainer to other x and y coordinates, and I press the 'close' Label: the 3D Animation starts BUT not in the actual position (after moving), the BorderContainer moves to its first position.

       

      How can I fix this behavior?

       

      THANKS!

      Raúl.

        • 1. Re: Strange behavior of Rotate3D
          CoreyRLucier Adobe Employee

          Hi Raúl,

           

          The following test seems to work, could you perhap modify it to be closer to what you are doing so we can reproduce?

           

          ---

           

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx">
             
              <fx:Script>
                  <![CDATA[
                     
                      public function cerrarFB():void{   
                          r3d.target=contenido;
                          r3d.play();
                      }
                  ]]>
              </fx:Script>

           

              <s:BorderContainer id='contenido' left="100" top="100">
                  <s:Label id='close' click="cerrarFB()" text="ABCDED" />
              </s:BorderContainer>

           

              <fx:Declarations>
                  <s:Rotate3D id="r3d"  angleXFrom="0" angleXTo="20"  />
                 
              </fx:Declarations>
          </s:Application>

          • 2. Re: Strange behavior of Rotate3D
            RaúlKirm Level 1

            As I said, the problem is after drag the Container and drop it to other coordinates, I have modified the script of CoreyRLucier, including drag&drop functions:

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx">
                
                <fx:Script>
                    <![CDATA[
                        
                        public function cerrarFB():void{   
                            r3d.target=contenido;
                            r3d.play();
                        }
                                    
                        public function startDD():void{
                            contenido.startDrag();
                        }
                        
                        public function finDD():void{
                            contenido.stopDrag();
                        }
            
                    ]]>
                </fx:Script>
                
                <s:BorderContainer id='contenido' left="100" top="100" mouseDown="startDD()" mouseUp="finDD()">
                    <s:Label id='close' click="cerrarFB()" text="ABCDED" />
                </s:BorderContainer>
                    
                
                <fx:Declarations>
                    <s:Rotate3D id="r3d"  angleXFrom="0" angleXTo="20"  />
                    
                </fx:Declarations>
            </s:Application>
            
            

             

             

            As you can see in this simple code, when drag the container to other place and press "Close" button, the container tries to go to its inicial place.

             

            THANKS!

             

            Raúl.

            • 3. Re: Strange behavior of Rotate3D
              Shongrunden Adobe Employee

              I think you might want to look into how to implement drag and drop in Flex rather than dragStart()/dragStop().  This page should be a good start: http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_7.htm l