我正在尝试在动作脚本移动应用程序中添加地图我已经为布局创建了 xml,因为 xml 布局的标签是预定义的,所以我相信我们无法创建自定义标签,所以我使用图像标签添加了该地图,但现在问题是疯狂的组件也禁用了它的滚动,没有遗憾,因为我已经在图像下创建了地图,我尝试将 scrollVertical 也放入,但是因为该地图位于图像标签下,所以没有奏效。
下面是我的代码。
package
{
import com.danielfreeman.madcomponents.*;
import com.mapquest.*;
import com.mapquest.services.geocode.*;
import com.mapquest.tilemap.*;
import com.mapquest.tilemap.controls.inputdevice.*;
import com.mapquest.tilemap.controls.shadymeadow.*;
import com.mapquest.tilemap.pois.*;
import flash.display.Screen;
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.media.StageWebView;
import flash.system.Capabilities;
import flash.text.TextField;
import flash.utils.flash_proxy;
import mx.events.FlexEvent;
public class map extends Sprite
{
private static var alResults:Array;
static var myMap:TileMap = new TileMap("my Key");
static var geocoder:Geocoder;
public static const LAYOUT:XML = <scrollVertical background="#DADED4" >
<imageLoader id="placeholder"> </imageLoader >
</scrollVertical>;
protected static var _message:UILabel;
public static function initialize():void{
var placeholder:UIImageLoader = UIImageLoader(UI.findViewById("placeholder"));
placeholder.scrollRect
placeholder.addChild(myMap);
myMap.addControl(new SMLargeZoomControl());
myMap.addControl(new SMViewControl());
myMap.addControl(new MouseWheelZoomControl());
myMap.size = new Size(300, 400);
myMap.addControl(new SMLargeZoomControl());
myMap.addControl(new SMViewControl());
myMap.addControl(new MouseWheelZoomControl());
// create a new TileMap object, passing your platform key
geocoder = new Geocoder(myMap);
geocoder.addEventListener(GeocoderEvent.GEOCODE_RESPONSE, onGeocodeResponse);
geocoder.addEventListener(GeocoderEvent.GEOCODE_ERROR_EVENT, onGeocodeError);
geocoder.addEventListener(GeocoderEvent.HTTP_ERROR_EVENT, onHttpError);
doGeocode();
}
public function map()
{
super();
}
private static function onGeocodeResponse(e:GeocoderEvent):void {
alResults = new Array();
for each (var loc:GeocoderLocation in e.geocoderResponse.locations) {
var o:Object = new Object();
o.LatLng = loc.displayLatLng.lat + ", " + loc.displayLatLng.lng;
o.GeocodeQuality = loc.geocodeQuality;
o.GeocodeQualityCode = loc.geocodeQualityCode;
alResults.push(o);
}
//this.dgResults.dataProvider = this.alResults;
//this.vgrpResults.visible = true;
}
private static function doGeocode():void {
//remove all shapes form the map
myMap.removeShapes();
//use the default cursor
//this.cursorManager.setBusyCursor();
//make an array to hold the addresses
var arrAddresses:Array = new Array();
//push the addresses onto the array
arrAddresses.push("placea");
arrAddresses.push("place b");
//call the geocoder object's geocode method, passing the array of addresses
geocoder.geocode(arrAddresses);
}
private static function onGeocodeError(e:GeocoderEvent):void {
//this.cursorManager.removeBusyCursor();
makeErrorList("GEOCODER ERROR");
}
/*
function to handle an error in the result
*/
private static function onHttpError(e:GeocoderEvent):void {
//this.cursorManager.removeBusyCursor();
makeErrorList("HTTP ERROR");
}
/*
function to make an array list to hold an error
*/
private static function makeErrorList(s:String):void {
var o:Object = new Object();
o.LatLng = s;
alResults.push(o);
//this.dgResults.dataProvider = this.alResults;
//this.vgrpResults.visible = true;
}
}
}
有没有人知道我如何实现我的目标:S 帮助将不胜感激。