Using Yahoo! Maps Web Service with MTASC

View: New views
8 Messages — Rating Filter:   Alert me  

Using Yahoo! Maps Web Service with MTASC

by Sean Mountcastle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ) 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
--
MTASC : no more coffee break while compiling

Re: Using Yahoo! Maps Web Service with MTASC

by ronatartifact :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

--
MTASC : no more coffee break while compiling

Re: Using Yahoo! Maps Web Service with MTASC

by Sean Mountcastle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Ron,

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

Doh! When I unpacked the SWC, the files were just prefixed with com.yahoo.maps. etc -- I wrote a script and translated those into directories and it's working much better now.  Though MTASC doesn't like Yahoo's LatLon class because it declares overloaded functions with different arguments.

Thanks for your help,
Sean

On 5/1/07, Sean Mountcastle <smountcastle@...> 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 ) 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


--
MTASC : no more coffee break while compiling

Re: Re: Using Yahoo! Maps Web Service with MTASC

by ronatartifact :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sounds like a better problem not. Perhaps Nicolas will have a solution.

Ron

Sean Mountcastle wrote:

> Ron,
>
> > Does the directory tree ./YahooMap/com/yahoo/maps/widgets contain
> > SatelliteControlWidget
>
> Doh! When I unpacked the SWC, the files were just prefixed with
> com.yahoo.maps. etc -- I wrote a script and translated those into
> directories and it's working much better now.  Though MTASC doesn't
> like Yahoo's LatLon class because it declares overloaded functions
> with different arguments.
>
> Thanks for your help,
> Sean
>
> On 5/1/07, *Sean Mountcastle* <smountcastle@...
> <mailto:smountcastle@...>> 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
>
>

--
MTASC : no more coffee break while compiling

Re: Re: Using Yahoo! Maps Web Service with MTASC

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Sounds like a better problem not. Perhaps Nicolas will have a solution.
>
> Ron

Uhm. Ask Yahoo to make its API MTASC-compatible ? :)
Since there is no proper overloading support in AS, that's wrong to rely
on it and that's why MTASC is forbidding it.

Best,
Nicolas

--
MTASC : no more coffee break while compiling

Parent Message unknown Re: Using Yahoo! Maps Web Service with MTASC

by Sean Mountcastle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nicholas,

> Uhm. Ask Yahoo to make its API MTASC-compatible ? :)
> Since there is no proper overloading support in AS, that's wrong to rely
> on it and that's why MTASC is forbidding it.

Yes, I have asked Yahoo to support MTASC. That's also why I didn't
post the compilation error to this mailing list.

Though I am curious, is there a way to have MTASC use a SWF as a
library (i.e. add it to the class path) so that I don't have to unpack
it and recompile it?

Many thanks for creating this excellent tool!

Sean

--
MTASC : no more coffee break while compiling

Re: Re: Using Yahoo! Maps Web Service with MTASC

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> Uhm. Ask Yahoo to make its API MTASC-compatible ? :)
>> Since there is no proper overloading support in AS, that's wrong to rely
>> on it and that's why MTASC is forbidding it.
>
> Yes, I have asked Yahoo to support MTASC. That's also why I didn't
> post the compilation error to this mailing list.
>
> Though I am curious, is there a way to have MTASC use a SWF as a
> library (i.e. add it to the class path) so that I don't have to unpack
> it and recompile it?

Not easily. You can use the Yahoo SWF and add it your code (with -swf
and -keep) and compile by using only "intrinsic" classes declarations
but it means you can't add other graphical resources.

Nicolas

--
MTASC : no more coffee break while compiling

Re: Re: Using Yahoo! Maps Web Service with MTASC

by Camillo Bruni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

or use swfmill to add it.

swfmill.org


Am 06.05.2007 um 12:00 schrieb Nicolas Cannasse:

>>> Uhm. Ask Yahoo to make its API MTASC-compatible ? :)
>>> Since there is no proper overloading support in AS, that's wrong  
>>> to rely
>>> on it and that's why MTASC is forbidding it.
>>
>> Yes, I have asked Yahoo to support MTASC. That's also why I didn't
>> post the compilation error to this mailing list.
>>
>> Though I am curious, is there a way to have MTASC use a SWF as a
>> library (i.e. add it to the class path) so that I don't have to  
>> unpack
>> it and recompile it?
>
> Not easily. You can use the Yahoo SWF and add it your code (with -swf
> and -keep) and compile by using only "intrinsic" classes declarations
> but it means you can't add other graphical resources.
>
> Nicolas
>
> --
> MTASC : no more coffee break while compiling


--
MTASC : no more coffee break while compiling

PGP.sig (193 bytes) Download Attachment