Hi, Jadd,

Sorry about not having responded for a while (was away).
Please, try using

                public function getMapWidht():Number
                {
                        return _map.getSize().x;
                }

                public function getMapHeight():Number
                {
                        return _map.getSize().y;
                }

Unfortunately, in Flash/pure AS3 width and height properties include
the areas of the object that are masked out and as a result, they
return values larger than the visible area of the map.
Let us know if it helps.

Thanks.

On Jun 4, 3:02 am, jadd <[email protected]> wrote:
> Thanks to reply, but again
> I would like to try to use the API in a PURE AS3 project (so not Flex
> or Flash cs something) and it seems impossible. I know perfectly that
> in Flex or Flash using the right component everything is ok. The
> problem is not to resize the map on a certain event (like in the
> Resizable example). I want that the size of the component is and will
> be what I expected to be. And this is not true it's bigger. I've tried
> to go further and inspect  the code (but without source is not
> possible to go further) and with a simple function (processChuildren -
> below):
>
>                 public function processChildren
> (container:DisplayObjectContainer):void
>                 {
>                         for (var i:int = 0; i < container.numChildren; i++)
>                          {
>                          // Process the child here. For example, the 
> following line
>                          // prints this child's string value as debugging 
> output.
>                          var thisChild:DisplayObject = 
> container.getChildAt(i);
>                          trace(thisChild.toString(  ) + " " + thisChild.name 
> + " " +
> thisChild.width + " " + thisChild.x);
>                          // If this child is, itself, a container, then 
> process its
> children.
>                          if (thisChild is DisplayObjectContainer)
>                          {
>                                 
> processChildren(DisplayObjectContainer(thisChild));
>                           }
>                         }
>                 }
>
> I traced out the result once when the "MAP" is added on stage and then
> when the stage resize. Many objects INSIDE del MAP object change their
> size and/or position:
>
> when added to stage:
>
> [object Map] instance3 800 0
> [object WrappableSprite] backgroundmc 800 0
> [object WrappableComponent] mapmc 800 0
> [object WrappableSprite] tilesmc 0 0
> [object WrappableSprite] instance23 0 0
> [object Sprite] instance32 0 0
> [object Sprite] instance33 0 0
> [object Tile] instance34 0 141.85
> [object Loader] instance35 0 0
> ....
>
> when resized:
>
> [object Map] instance3 800 0
> [object WrappableSprite] backgroundmc 800 0
> [object WrappableComponent] mapmc 1535.95 0
> [object WrappableSprite] tilesmc 1535.95 0
> [object WrappableSprite] instance23 1535.95 0
> [object Sprite] instance32 1535.95 0
> [object Sprite] instance33 1535.95 0
> [object Tile] instance34 256 141.85
> [object Loader] instance35 256 0
> ....
>
> The trace is much more longer and without source code i can't know
> what does it mean. But it's clear for me from those line above that
> something happen inside the MAP. I hope in your reply. Please try the
> simple example below and see what happen, and let me know what I can
> more. Thanks.
>
> wrapper class:
>
> package
> {
>         import com.qubozone.flash.map.SimpleMap;
>         import flash.display.DisplayObject;
>         import flash.display.DisplayObjectContainer;
>         import flash.display.Sprite;
>         import flash.display.StageAlign;
>         import flash.display.StageScaleMode;
>         import flash.events.Event;
>         import flash.geom.Point;
>
>         public class GoogleMapWrapper extends Sprite
>         {
>                 private var _simpleMap:SimpleMap
>
>                 public function GoogleMapWrapper()
>                 {
>                         initStage();
>                         initMap();
>                 }
>
>                 private function initStage():void
>                 {
>                         stage.align = StageAlign.TOP_LEFT;
>                         stage.scaleMode = StageScaleMode.NO_SCALE;
>                         stage.addEventListener(Event.RESIZE, onStageResize);
>                 }
>
>                 private function initMap():void
>                 {
>                         _simpleMap = new SimpleMap("map.xml");
>                         _simpleMap.addEventListener(Event.COMPLETE, 
> onComplete);
>                         addChild(_simpleMap);
>                 }
>
>                 private function onComplete(e:Event):void
>                 {
>                         align();
>                         _simpleMap.removeEventListener(Event.COMPLETE, 
> onComplete);
>                 }
>
>                 private function onStageResize(e:Event):void
>                 {
>                         align();
>                 }
>
>                 private function align():void
>                 {
>                         _simpleMap.x = (stage.stageWidth - _simpleMap.width) 
> * 0.5;
>                         _simpleMap.y = (stage.stageHeight - 
> _simpleMap.height) * 0.5;
>                 }
>         }
>
> }
>
> SimpleMap class:
>
> package com.qubozone.flash.map
> {
>         import com.google.maps.*;
>         import com.google.maps.controls.*;
>         import com.google.maps.overlays.*;
>         import com.qubozone.flash.loaders.RequestXMLLoader;
>
>         import flash.display.MovieClip;
>         import flash.events.Event;
>         import flash.geom.Point;
>
>         public class SimpleMap extends MovieClip
>         {
>                 private var _url:String;
>                 private var _xmlLoader:RequestXMLLoader;
>                 private var _xml:XML;
>                 private var _map:Map;
>                 private var _mapOptions:MapOptions;
>                 private var _markerOptions:MarkerOptions;
>
>                 public function SimpleMap(url:String)
>                 {
>                         _url = url;
>                         loadXml();
>                 }
>
>                 private function loadXml():void
>                 {
>                         _xmlLoader = new RequestXMLLoader();
>                         _xmlLoader.addEventListener(Event.COMPLETE, 
> onXmlLoaderComplete);
>                         _xmlLoader.loadRequest(_url);
>                 }
>
>                 private function onXmlLoaderComplete(e:Event):void
>                 {
>                         _xml = _xmlLoader.loadXml();
>                         initMap(_xml);
>                         _xmlLoader.removeEventListener(Event.COMPLETE,
> onXmlLoaderComplete);
>                 }
>
>                 private function initMap(xml:XML):void
>                 {
>                         _map = new Map();
>                         _map.addEventListener(MapEvent.MAP_PREINITIALIZE,
> onMapPreinitialize);
>                         _map.addEventListener(MapEvent.MAP_READY, onMapReady);
>                         _map.key = _xml..location.key;
>                         var s:String = _xml..location.size;
>                         var a:Array = s.split(",", 2);
>                         _map.setSize(new Point(a[0], a[1]));
>                         addChild(_map);
>                 }
>
>                 private function onMapPreinitialize(e:MapEvent):void
>                 {
>                         _mapOptions = new MapOptions();
>                 var s:String = _xml..location.center;
>                 var a:Array = s.split(",", 2);
>                         _mapOptions.center = new LatLng(a[0], a[1]);
>                         _mapOptions.zoom = Number(_xml..location.zoom);
>                 _map.setInitOptions(_mapOptions);
>                 }
>
>                 private function onMapReady(e:MapEvent):void
>                 {
>                         _map.addControl(new ZoomControl());
>                         _map.addControl(new PositionControl());
>                         _map.addControl(new MapTypeControl());
>                         _map.addOverlay(new Marker(_map.getCenter()));
>                         dispatchEvent(new Event(Event.COMPLETE));
>                 }
>
>                 public function getMapWidht():Number
>                 {
>                         return _map.width;
>                 }
>
>                 public function getMapHeight():Number
>                 {
>                         return _map.height;
>                 }
>         }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to