2 Replies Latest reply on Aug 18, 2009 4:49 AM by JavaFlexMan

    Error in accessing rotationY, rotationX, or rotationZ

    JavaFlexMan

      Hello,

      I am trying out the 3D effects I can get by using rotationY and the other rotation(...) values. Unfortunately, Flex3 won't compile whenever I access any rotation values. Here is my code. I got this code off a blog.

       

      <?xml version="1.0"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="vertical">
         <mx:Script>
              <![CDATA[
                  private function reset():void {
                      rXSlider.value = 0;
                      rYSlider.value = 0;
                      rZSlider.value = 0;
                      img.rotationX = 0;
                      img.rotationY = 0;
                      img.rotationZ = 0;
                  }
              ]]>
          </mx:Script>
          <mx:Form>
              <mx:FormItem label="rotationX:" direction="horizontal">
                  <mx:HSlider id="rXSlider"
                          minimum="-360"
                          maximum="360"
                          value="0"
                          snapInterval="2"
                          tickInterval="30"
                          liveDragging="true"
                          width="200"
                          change="img.rotationX = event.value;" />
                  <mx:Label text="{rXSlider.value}" />
              </mx:FormItem>
              <mx:FormItem label="rotationY:" direction="horizontal">
                  <mx:HSlider id="rYSlider"
                          minimum="-360"
                          maximum="360"
                          value="0"
                          snapInterval="2"
                          tickInterval="30"
                          liveDragging="true"
                          width="200"
                          change="img.rotationY = event.value;" />
                  <mx:Label text="{rYSlider.value}" />
              </mx:FormItem>
              <mx:FormItem label="rotationZ:" direction="horizontal">
                  <mx:HSlider id="rZSlider"
                          minimum="-360"
                          maximum="360"
                          value="0"
                          snapInterval="2"
                          tickInterval="30"
                          liveDragging="true"
                          width="200"
                          change="img.rotationZ = event.value;" />
                  <mx:Label text="{rZSlider.value}" />
              </mx:FormItem>
              <mx:FormItem>
                  <mx:Button label="Reset" click="reset();" />
              </mx:FormItem>
          </mx:Form>
          <mx:Canvas width="100%" height="100%">
              <mx:Image id="img"
                      source="@Embed('Fx.png')"
                      width="100"
                      height="100"
                      horizontalCenter="0"
                      verticalCenter="0" />
          </mx:Canvas>
      </mx:Application>
      Everything in this script seems to be correct, but when I compile I get this error.

       

      C:\Vance\BibleDesktop\T3d\src>mxmlc Main.mxml
      Loading configuration file C:\Vance\Downloads\Flex\flex_sdk_3\frameworks\flex-co
      nfig.xml
      C:\Vance\BibleDesktop\T3d\src\Main.mxml(10):  Error: Access of possibly undefine
      d property rotationX through a reference with static type mx.controls:Image.

       

                      img.rotationX = 0;

       

      C:\Vance\BibleDesktop\T3d\src\Main.mxml(11):  Error: Access of possibly undefine
      d property rotationY through a reference with static type mx.controls:Image.

       

                      img.rotationY = 0;

       

      C:\Vance\BibleDesktop\T3d\src\Main.mxml(12):  Error: Access of possibly undefine
      d property rotationZ through a reference with static type mx.controls:Image.

       

                      img.rotationZ = 0;

       

      What am I doing wrogn? I am completely new to Flex, so I hope I am not doing something stupid.

       

      Also, what does the documentation mean by 3D parent containers? For instance, here is the part of the doc of rotationY:"Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container..." Is there some way to set a container to be 3D or, are some containers 3D capable?

      Thank-you,

      Vance