PageRenderTime 151ms CodeModel.GetById 143ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/google/maps/extras/planetary/SkyTileLayer.as

http://gmaps-utility-library-flash.googlecode.com/
ActionScript | 51 lines | 27 code | 7 blank | 17 comment | 0 complexity | 5b6c4fa3b123c05bbd5e4127c4d50963 MD5 | raw file
 1/*
 2* Copyright 2008 Google Inc. 
 3* Licensed under the Apache License, Version 2.0:
 4*  http://www.apache.org/licenses/LICENSE-2.0
 5*/
 6package com.google.maps.extras.planetary {
 7
 8import com.google.maps.CopyrightCollection;
 9import com.google.maps.TileLayerBase;
10
11import flash.display.DisplayObject;
12import flash.display.Loader;
13import flash.events.*;
14import flash.geom.Point;
15import flash.net.URLRequest;
16
17/**
18 * @private
19 */
20public class SkyTileLayer extends TileLayerBase {
21
22  private var _baseUrl:String;
23  
24  /**
25   * Constructor for the class.
26   */
27  public function SkyTileLayer(baseUrl:String, copyrightCollection:CopyrightCollection, zoomLevels:Number) {
28    super(copyrightCollection, 0, zoomLevels);
29    this._baseUrl = baseUrl; 
30  }
31
32  /**
33   * Creates and loads a tile (x, y) at the given zoom level.
34   * @param tilePos  Tile coordinates.
35   * @param zoom  Tile zoom.
36   * @return  Display object representing the tile.
37   */
38  public override function loadTile(tilePos:Point, zoom:Number):DisplayObject {
39    var testLoader:Loader = new Loader();
40    var urlRequest:URLRequest = new URLRequest(
41       this._baseUrl + tilePos.x + "_" + tilePos.y + "_" + zoom + ".jpg"); 
42    testLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
43    testLoader.load(urlRequest);	
44    return testLoader;
45  }
46
47  private function ioErrorHandler(event:IOErrorEvent):void {
48    trace("ioErrorHandler: " + event);
49  }
50}
51}