4 Replies Latest reply on May 6, 2010 7:51 AM by Alex Uhlmann

    Runtime error with Navigation lib & spark children in a viewstack




      As you probably know, in Flex 4, you have to wrap a spark component inside a NavigatorContent tag in order to use it as a viewstack child.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" xmlns:local="*" >
                <local:ASparkComponent />
                <local:AnotherSparkComponent />


      The problem is, if you want to use a waypoint for this viewstack, you'll get a runtime error. The navigation lib considers viewstacks children are Container but this is not true anymore in Flex 4. Viewstack expects its children to implements INavigatorContent.


      I solved the issue by replacing Container references in SelectChildWaypoint with NavigatorContent. This means however, you won't be able to use this class anymore for Flex 3 projects. So I thought it would be better to have 2 classes derived from AbstractWaypoint: one to use for Flex 3 projets and the other one for Flex 4. A runtime version check could be done in the WaypointHandler.createWaypoint method in order to instanciate the good class. Thoughts?