[Papervision3D] bitmap.draw with google maps

eric mcconkie mlecho at yahoo.com
Sat Jun 6 10:06:19 PDT 2009


ok, i have an error i have reasearched for a good 10 hours now. I have to take it to the boards. I am importing the google map api into mc's. I then add the mcs to Papervision as  a MovieMaterial. Finally, the material is added to a cube, where then some crazy math occurs to position each 'tile' in a sudo map like structure. The issue i am having is getting the maps to cooperate with PVs bitmap.draw methods. Is there a known work around to this? some way i can get the maps to be redrawn? it works on my local build (on compile) but now when accessed via http. ugh.

the core methods in my class are like so:

private function _startMap() : void
{
    mc = newGoogleMap();
    mc.visible=false;
    mc.x = -2000;
    MapLab.instance.addChild(mc);
    make3D();
}

private function make3D() : void
{
    
    var mm:MovieMaterial = new  MovieMaterial(mc,false,true,true,new Rectangle(0,0,mc.width,mc.height));
    mm.doubleSided = false;
    mm.interactive= true;
    mm.animated = true;
    //mm.allowAutoResize = false;
    
    var lt:Object = MapLab.instance.light;
    var gm:GouraudMaterial = new GouraudMaterial(lt.light,lt.color,lt.ambient);
    gm.doubleSided = false;
    gm.interactive = true;
    var mList:MaterialsList = new MaterialsList();
    mList.addMaterial(gm,'all');
    mList.addMaterial(mm,'back');
    
    var c:Cube = new Cube(mList,mc.width,10,mc.height)
    addChild(c)
    c.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,onClick);
}

private function geoCode() : void
{
    var gc:ClientGeocoder = new ClientGeocoder();
    gc.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,onGeoCode);
    gc.addEventListener(GeocodingEvent.GEOCODING_FAILURE,onGeoFail);
    
    if(this.location != undefined) 
    {
        gc.geocode(this.location);
    }else
    {
        this.visible = false;
    }
}

private function onClick(e:InteractiveScene3DEvent) : void
{

    var ev:MapEvent3D = new MapEvent3D(MapEvent3D.CLICK)
    dispatchEvent(ev);         
}

private function preset(e:MapEvent):void
{
    var myMapOptions:MapOptions = new MapOptions();     
        this.map.setInitOptions(myMapOptions);
}

private function onMapReady(event:MapEvent):void 
{                                          
      geoCode();
      
}
    
private function onGeoCode(e:GeocodingEvent) : void
{
    map.setCenter(e.response.placemarks[0].point,Number(dataObject.zoom),MapType.SATELLITE_MAP_TYPE);
    this.latlng = e.response.placemarks[0].point as LatLng;
    
    var mapOb:Object = new Object()
    mapOb.latLng =  this.latlng;
    MonsterDebugger.trace(this,this,0xff0000,true);
    dispatchEvent(new MapEvent3D(MapEvent3D.LOCATE,mapOb)) ;
}

private function onGeoFail(e:GeocodingEvent) : void
{
    trace(dataObject.location +"  is NOT loading as a geocode");
    dispatchEvent(new MapEvent3D(MapEvent3D.DIE));                
}


private function newGoogleMap() : MovieClip
{    
    mc = new MovieClip();
    map = new Map();
    map.key = String(MapLab.instance.googleKey);
         
    map.addEventListener(MapEvent.MAP_PREINITIALIZE,preset)
    map.addEventListener(MapEvent.MAP_READY, onMapReady);
    mc.addChild(map);
    return mc;
}


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090606/d7de8f6e/attachment.html>


More information about the Papervision3D mailing list