[mtasc] Using Yahoo! Maps Web Service with MTASC

Ron Wheeler rwheeler at artifact-software.com
Tue May 1 22:23:19 CEST 2007


Does the directory tree ./YahooMap/com/yahoo/maps/widgets contain 
SatelliteControlWidget

Ron

Sean Mountcastle wrote:
> I'm trying to get the sample code "Dynamically attaching a Yahoo! Map 
> to your SWF" from here 
> (http://developer.yahoo.com/maps/flash/asGettingStarted.html 
> <http://developer.yahoo.com/maps/flash/asGettingStarted.html>) to 
> compile using MTASC (http://www.mtasc.org) but I'm having some difficulty.
>
> Here are the steps I took:
> 1) Downloaded YWS Maps SWC file (for Flex)
> 2) Unzipped the file and renamed all of the .asi files to .as (I did 
> this based on the SWC Ant task described here: http://osflash.org/hamtasc)
> 3) Cut-and-paste the sample code from the YWS Map page and place it 
> inside a class like so:
>
> import com.yahoo.maps.LatLon;
> import com.yahoo.maps.api.Languages ;
> import com.yahoo.maps.MapViews;
> import com.yahoo.maps.tools.PanTool;
> import com.yahoo.maps.widgets.SatelliteControlWidget;
> import com.yahoo.maps.widgets.ZoomBarWidget;
>
> class MapTest {
>
>         static var app : MapTest;
>
>         function MapTest() {
>                 var satControl:SatelliteControlWidget = new 
> SatelliteControlWidget(SatelliteControlWidget.HORIZONTAL);
>                 var zoomControl:ZoomBarWidget = new ZoomBarWidget();
>                 var pantool:PanTool = new PanTool();
>         
>                 //Create a map centered on 41.890522, 12.500553, zoom 
> level of 8, hybrid view type and using the Italian language.
>                 var mapdata:Object = { latlon:new LatLon( 
> 41.890522,12.500553),
>                                        zoomLevelStr:8,
>                                        mapViewType:MapViews.HYBRID,
>                                        language:Languages.it_IT,
>                                        _xscale:2200,
>                                        _yscale:1600,
>                                        appidStr:"<secret>" };
>
>                 //create map container movie clip
>                 var mapContainer = 
> this.createEmptyMovieClip("mapContainer", 1 );
>         
>                 //attach map to mapContainer
>                 var map = 
> mapContainer.attachMovie("com.yahoo.maps.api.flash.YahooMap ", "map", 
> 1, mapdata);
>         
>                 //add EVENT_INITIALIZE listener
>                 
> map.addEventListener(com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE, 
> onMapInit);
>         }
>
>         // entry point
>         static function main(mc) {
>                 app = new MapTest();
>         }
>
>         function onMapInit(event:Object):Void {
>             //add SatelliteControlWidget with its buttons arranged 
> horizontally
>             map.addWidget(satControl);
>             //add zoom control
>             map.addWidget(zoomControl);
>             //add pan tool
>             map.addTool(pantool, true);
>         }
> }
>
> 4) Compile it using MTASC: mtasc -cp /usr/lib/ocaml/mtasc/std -cp 
> ./YahooMap -mx -swf maptest.swf -main -header 800:600:20 MapTest.as
>
> Unfortunately, MTASC can't seem to find some of the files, even though 
> I added the directory to the classpath (-cp ./YahooMap) and spits outs 
> the following error:
>
> MapTest.as:13: characters 16-30 : type error class not found : 
> com.yahoo.maps.widgets.SatelliteControlWidget
>
> Any ideas on how to fix this?
>
> Many thanks in advance,
> Sean 



More information about the mtasc mailing list