0 Replies Latest reply on Aug 26, 2007 4:59 AM by gara789

    Flex 2 with AS 3.0: Transitions code compilation error

    gara789
      I just bought "The Essential Guide to Flex 2 with ActionScript 3.0. (Friends of Ed 2007) In order to work through the examples, I downloaded Flex 3.0 beta. Its been going well ... until starting the exercises on transitions.

      I've narrowed the problem down to the "relativeTo" attribute of the AddChild class. This snipped builds and runs fine:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:states>
      <mx:State name="bookDetails" basedOn="">
      <mx:AddChild creationPolicy="all" position="lastChild">
      <mx:FormItem id="isbn" label="ISBN: 1590595432" />
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:Panel title="Book" id="book" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:Form id="bookForm">
      <mx:FormItem label="Foundation XML Flash" fontWeight="bold" />
      <mx:FormItem label="Sas Jacobs" fontStyle="italic" />
      </mx:Form>
      <mx:ControlBar>
      <mx:LinkButton label="Book Details" id="bookLink" />
      <mx:Spacer width="100%" id="spacer1" />
      <mx:Label text="Book Title" id="title" />
      </mx:ControlBar>
      </mx:Panel>


      </mx:Application>

      However, as soon as I add relativeTo, e.g:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:states>
      <mx:State name="bookDetails" basedOn="">
      <mx:AddChild relativeTo="{bookForm}" creationPolicy="all" position="lastChild">
      <mx:FormItem id="isbn" label="ISBN: 1590595432" />
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:Panel title="Book" id="book" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:Form id="bookForm">
      <mx:FormItem label="Foundation XML Flash" fontWeight="bold" />
      <mx:FormItem label="Sas Jacobs" fontStyle="italic" />
      </mx:Form>
      <mx:ControlBar>
      <mx:LinkButton label="Book Details" id="bookLink" />
      <mx:Spacer width="100%" id="spacer1" />
      <mx:Label text="Book Title" id="title" />
      </mx:ControlBar>
      </mx:Panel>


      </mx:Application>

      Flex Builder 2 gives me the following error:

      Type was not found or was not a compile-time constant.


      Thinking this might have been a bug with Flex 3.0, I uninstalled then installed the most recent release of version 2. I still get the same problem. Any ideas?