I am trying to convert some legacy Flexbuilder 3 code to Flash 4 api 3.4. A user will click on the desired Legislator in a list widget. I get the widget to come up but no list.
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<!--
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010-2011 Esri. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:viewer="com.esri.viewer.*"
widgetConfigLoaded="init()">
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
//this function called when the widget's configuration is loaded
private function init():void
{
if (configXML) // checking for valid content in the configuration file
{
lbl.text = configXML.content || getDefaultString("helloContent");
}
}
import com.esri.ags.events.GenerateRendererEvent;
import com.esri.ags.renderers.Renderer;
import com.esri.ags.tasks.supportClasses.GenerateRendererParameters;
import flash.events.Event;
import flash.net.URLRequest;
private var u:URLRequest;
// Event handler to open URL using navigateToURL().
private function handleClick(eventObj:Event):void {
u = new URLRequest(data.webPage);
navigateToURL(u);
}
import mx.core.ClassFactory;
public function initCellEditor():void {
// myList.itemRenderer=new ClassFactory(RendererState);
myList.itemRenderer=new ClassFactory(Renderer);
}
]]>
</fx:Script>
<viewer:WidgetTemplate id="LegislatorList"
width="300" height="300">
<viewer:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</viewer:layout>
<s:Label id="lbl"
width="100%"
fontSize="18"
fontStyle="italic"
fontWeight="bold"/>
<mx:VBox label="Pick Your Legislator" styleName="WidgetCanvas">
<mx:List id="myList" variableRowHeight="false" height="475" width="180" alpha="0">
<mx:dataProvider>
<fx:Object label="1"
data="Al Krupski"
webPage="http://legis.suffolkcountyny.gov/do/do01/do01.html"/>
<fx:Object label="2"
data="Jay H. Schneiderman"
webPage="http://legis.suffolkcountyny.gov/do/do02/do02.html" />
<fx:Object label="3"
data="Kate M. Browning"
webPage="http://legis.suffolkcountyny.gov/do/do03/do03.html"/>
<fx:Object label="4"
data="Tom Muratore"
webPage="http://legis.suffolkcountyny.gov/do/do04/do04.html"/>
<fx:Object label="5"
data="Kara Hahn"
webPage="http://legis.suffolkcountyny.gov/do/do05/do05.html"/>
<fx:Object label="6"
data="Sarah Anker"
webPage="http://legis.suffolkcountyny.gov/do/do06/do06.html"/>
<fx:Object label="7"
data="Robert Calarco"
webPage="http://legis.suffolkcountyny.gov/do/do07/do07.html"/>
<fx:Object label="8"
data="William J. Lindsay"
webPage="http://legis.suffolkcountyny.gov/do/do08/do08.html"/>
<fx:Object label="9"
data="Ricardo Montano"
webPage="http://legis.suffolkcountyny.gov/do/do09/do09.html"/>
<fx:Object label="10"
data="Tom Cilmi"
webPage="http://legis.suffolkcountyny.gov/do/do10/do10.html"/>
<fx:Object label="11"
data="Thomas F. Barraga"
webPage="http://legis.suffolkcountyny.gov/do/do11/do11.html"/>
<fx:Object label="12"
data="John M. Kennedy, Jr."
webPage="http://legis.suffolkcountyny.gov/do/do12/do12.html"/>
<fx:Object label="13"
data="Lynne C. Nowick"
webPage="http://legis.suffolkcountyny.gov/do/do13/do13.html"/>
<fx:Object label="14"
data="Wayne R. Horsley"
webPage="http://legis.suffolkcountyny.gov/do/do14/do14.html"/>
<fx:Object label="15"
data="DuWayne Gregory"
webPage="http://legis.suffolkcountyny.gov/do/do15/do15.html"/>
<fx:Object label="16"
data="Steve Stern"
webPage="http://legis.suffolkcountyny.gov/do/do16/do16.html"/>
<fx:Object label="17"
data="Lou D'Amaro"
webPage="http://legis.suffolkcountyny.gov/do/do17/do17.html"/>
<fx:Object label="18"
data="William Spencer"
webPage="http://legis.suffolkcountyny.gov/do/do18/do18.html"/>
</mx:dataProvider>
</mx:List>
<mx:LinkButton id="webPage" label="LD {data.label} {data.data}"
click="handleClick(event)"/>
</mx:VBox>
</viewer:WidgetTemplate>
</viewer:BaseWidget>