Obtain reference to View in ActionScript class within ViewNavigatorApplication

Posted by chb on Stack Overflow See other posts from Stack Overflow or by chb
Published on 2011-11-28T13:43:12Z Indexed on 2011/12/01 1:52 UTC
Read the original article Hit count: 200

Filed under:
|

I've got a very simple project in FlashBuilder 4.5. It's a mobile application of type ViewNavigatorApplication with a single view, MapView. In the MapView.mxml file, I've got a Flex component of type Map declared in xml.

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" name="CatBusMapView">

    <fx:Script>
            <![CDATA[
                import com.esri.ags.Map;
                        ....
                    ]]>
    </fx:Script>

    <fx:Declarations>
     ....
    </fx:Declarations>

    <esri:Map id="cbm">
        ...
    </esri:Map>
</s:View>

In this same project, I've an actionscript class called UserGeolocation. In this class, I'm attempting to get a reference to this map component.

So far, I can get a reference to the top-level application, its ViewNavigator and the NavigationStack of said ViewNavigator. However, I cannot find a way to access the MapView, much less the map I've declared within it.

I'm aware of methods like firstView() and activeView(), but I want an absolute solution, one that retrieves the view regardless of whether or not it's first or active. I've tried navigator.getChildByName("MapView") with no luck.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex4.5