| Package | com.afcomponents.umap.display |
| Class | public class InfoWindow |
| Inheritance | InfoWindow Overlay MapObject flash.display.Sprite |
| Implements | IInfoWindow |
To control Info Window appearence use InfoWindowStyle class,
set by passing to the constructor or using setStyle() method.
You can also specify the title & content text which will be displayed in the window.
import com.afcomponents.umap.core.UMap;
import com.afcomponents.umap.styles.*;
import com.afcomponents.umap.display.InfoWindow;
import com.afcomponents.umap.types.Size;
// create new map
var map:UMap = new UMap();
map.setSize(300,300);
addChild(map);
// define info window style
var style:InfoWindowStyle = new InfoWindowStyle();
style.strokeAlpha = 0.8;
style.size = new Size(200,100);
style.autoSize = InfoWindowStyle.AUTO_SIZE_NONE;
style.tailSize.height = 30;
style.tailOffset = 0.10;
style.contentStyle.html = true;
style.contentStyle.styleSheet = new StyleSheet();
style.contentStyle.styleSheet.setStyle("html", {fontFamily:"arial", fontSize:12, color:"#555555"});
// define info window parameters
var param:Object = new Object();
param.title = "Info window title";
param.content = "Info window content...<br/>can be multiline<br/>and contain <b><u>HTML</u></b> tags.";
// open new info window
map.openInfoWindow(param, style);
After executing the code you should see something like this:
See also
| Property | Defined by | ||
|---|---|---|---|
![]() | asDisplayObject : DisplayObject
Returns reference to the object as a DisplayObject instance.
| MapObject | |
| asInteractiveObject : InteractiveObject [read-only]
Casts
InfoWindow as an InteractiveObject. | InfoWindow | ||
![]() | autoCloseInfo : Boolean
Gets or sets the autCloseInfo flag, which indicates whether to close
info window automatically when user clicks somewhere on the map.
| Overlay | |
![]() | autoInfo : Boolean
Gets or sets the autInfo flag, which indicates whether to open info window automatically upon mouse click.
| Overlay | |
| autoPan : Boolean
Gets or sets autoPan property
| InfoWindow | ||
| closeButton : Sprite [read-only]
Returns a reference to the close button Sprite.
| InfoWindow | ||
| contentPanel : IPanel [read-only]
Returns a reference to the content panel.
| InfoWindow | ||
![]() | core : UMap
Returns reference to the core UMap object.
| MapObject | |
![]() | data : *
Gets or sets the data parameter of the Overlay.
| Overlay | |
![]() | description : String
Gets or sets the description text of the Overlay.
| Overlay | |
![]() | draggable : Boolean
Gets or sets Overlay's draggable property.
| Overlay | |
![]() | dragging : Boolean
Indicates whether Overlay is being dragged at the moment.
| Overlay | |
![]() | id : uint
Gets or sets the ID of the object.
| MapObject | |
![]() | info : IInfoWindow
Return referens to opened InfoWindow
| Overlay | |
![]() | infoParam : Object
Gets or sets the info window param object.
| Overlay | |
![]() | infoStyle : Object
Gets or sets the info window style object associated with the Overlay.
| Overlay | |
| main : Sprite [read-only]
Returns a reference to the main Sprite.
| InfoWindow | ||
![]() | name : String
Gets or sets the name of the object.
| Overlay | |
![]() | owner : IMapObjectContainer
Returns reference to the owner container object.
| MapObject | |
![]() | point : Point
Returns the position of the Overlay in bitmap coordinates.
| Overlay | |
![]() | position : LatLng
Gets or set the geographical position of the Overlay.
| Overlay | |
| scrollBar : * [read-only]
Returns a reference to the attached scroll bar or null of no scroll bar class has been defined.
| InfoWindow | ||
![]() | smartPosition : Boolean
Gets or sets the smartPosition flag, which indicates whether to use smart positioning with the Overlay.
| Overlay | |
| titlePanel : IPanel [read-only]
Returns a reference to the title panel.
| InfoWindow | ||
![]() | visible : Boolean
Gets or sets the Overlay's visibility.
| Overlay | |
![]() | zIndexAuto : Boolean
Gets or sets zIndexAuto property which indicates wheter Overlay should be brought to front on mouse over event.
| Overlay | |
| Method | Defined by | ||
|---|---|---|---|
|
InfoWindow(param:Object = null, style:Object = null)
InfoWindow's constructor.
| InfoWindow | ||
![]() |
addEventListeners(target:InteractiveObject = null):void
Adds a built-in listener for MouseEvents fired by an InteractiveObject contained in the Overlay.
| Overlay | |
![]() |
bringToFront():void
Brings target Overlay to the top of the parent's display list.
| Overlay | |
![]() |
Creates an exact copy of this Overlay and returns it to the user.
| Overlay | |
|
close():void
Closes the info window.
| InfoWindow | ||
![]() |
closeInfoWindow():void
Closes info window that is currently opened.
| Overlay | |
|
dispose():void
Releases all the resources accuired by the object.
| InfoWindow | ||
![]() |
dragStart():void
Starts Overlay dragging.
| Overlay | |
![]() |
dragStop():void
Stops Overlay dragging.
| Overlay | |
![]() |
[static]
Fetches Overlay's common properties from XML object in KML 2.1 format.
| Overlay | |
|
Retruns Overlay bounds in geographical coordinates.
| InfoWindow | ||
|
getBoundsXY(zoom:Number = 0):Bounds
Retruns Overlay bounds in bitmap coordinates.
| InfoWindow | ||
|
Returns TextStyle that is applied to the content Text Field.
| InfoWindow | ||
|
[static]
Returns the default InfoWindowStyle object that will be assigned to the newely created info window.
| InfoWindow | ||
|
getScrollBarClass():Class
[static]
Returns the class that is used as a scroll bar for the info window.
| InfoWindow | ||
|
getStyle():Object
Returns the InfoWindowStyle object associated with the info window.
| InfoWindow | ||
|
Returns TextStyle that is applied to the title Text Field.
| InfoWindow | ||
|
hide():void
Hides overlay.
| InfoWindow | ||
![]() |
invalidate():void
Schedules the Overlay for invalidation in 1 frame after this call.
| Overlay | |
|
isOpen():Boolean
Returns a Boolean value which indicates whether info window is opened.
| InfoWindow | ||
|
move(x:Number, y:Number):void
| InfoWindow | ||
|
open(param:Object = null, style:Object = null):void
Opens the info window.
| InfoWindow | ||
![]() |
openInfoWindow(param:Object = null, style:Object = null):IInfoWindow
Opens new info window with the specified parameters & style.
| Overlay | |
|
redraw():void
Redraws the overlay.
| InfoWindow | ||
|
refresh(full:Boolean = false):void
Refreshes overlay position on the map.
| InfoWindow | ||
![]() |
remove():void
Removes the object from the owner container object.
| MapObject | |
![]() |
removeEventListeners(target:InteractiveObject = null):void
Removes a built-in listener for MouseEvents fired by an InteractiveObject contained in the Overlay.
| Overlay | |
|
reset():void
Resets the style & data for panels.
| InfoWindow | ||
|
setContentStyle(param:Object):void
Sets new style for the content Text Field.
| InfoWindow | ||
|
setDefaultStyle(style:Object):void
[static]
Sets the default InfoWindowStyle object that will be assigned to the newely created info window.
| InfoWindow | ||
![]() |
setOwner(owner:IMapObjectContainer):void
Adds the object to the specified IMapObjectContainer.
| MapObject | |
|
setScrollBarClass(scrollBarClass:Class):void
[static]
Sets the class that will be instantiated and
used as a scroll bar for the info window.
| InfoWindow | ||
|
setStyle(param:Object):void
Sets a new style for the Info Window.
| InfoWindow | ||
|
setTitleStyle(param:Object):void
Sets new style for the title Text Field.
| InfoWindow | ||
|
show():void
Shows overlay.
| InfoWindow | ||
![]() |
toString():String
Returns a textual representation of the object.
| MapObject | |
![]() |
toXML(full:Boolean = true, afcTags:Boolean = false):XML
Builds an XML object in KML 2.1 format that describes the Overlay & it's style.
| Overlay | |
![]() |
updatePosition(latlng:LatLng):void
Invoked when map center has been updated.
| Overlay | |
![]() |
updateZoom(zoom:Number):void
Invoked when map zoom has been updated.
| Overlay | |
| asInteractiveObject | property |
asInteractiveObject:InteractiveObject [read-only]
Casts InfoWindow as an InteractiveObject.
public function get asInteractiveObject():InteractiveObject
| autoPan | property |
autoPan:Boolean [read-write]Gets or sets autoPan property
Implementation public function get autoPan():Boolean
public function set autoPan(value:Boolean):void
| closeButton | property |
closeButton:Sprite [read-only]Returns a reference to the close button Sprite.
Implementation public function get closeButton():Sprite
| contentPanel | property |
contentPanel:IPanel [read-only]Returns a reference to the content panel.
Implementation public function get contentPanel():IPanel
| main | property |
main:Sprite [read-only]Returns a reference to the main Sprite.
Implementation public function get main():Sprite
| scrollBar | property |
scrollBar:* [read-only]Returns a reference to the attached scroll bar or null of no scroll bar class has been defined.
Implementation public function get scrollBar():*
| titlePanel | property |
titlePanel:IPanel [read-only]Returns a reference to the title panel.
Implementation public function get titlePanel():IPanel
| InfoWindow | () | constructor |
public function InfoWindow(param:Object = null, style:Object = null)InfoWindow's constructor.
Creates new info window with the specified properties & style.
After window is created it should be attached to a MapObjectContainer container
by a setOwner() call.
param:Object (default = null) — Object that holds all the properites of an info window you wish to override upon its creation.
|
|
style:Object (default = null) — Object that defines window's style.
|
| close | () | method |
public function close():voidCloses the info window.
| dispose | () | method |
public override function dispose():voidReleases all the resources accuired by the object.
| getBoundsLatLng | () | method |
public override function getBoundsLatLng():LatLngBoundsRetruns Overlay bounds in geographical coordinates.
ReturnsLatLngBounds —
Overlay bounding rectangle in geographical coordinates.
|
| getBoundsXY | () | method |
public override function getBoundsXY(zoom:Number = 0):Bounds
Retruns Overlay bounds in bitmap coordinates. Use zoom parameter to specify zoom level for bounds conversion.
zoom:Number (default = 0) — Defines the zoom level at which to perform bounds conversion; if omitted, current zoom level will be used.
|
Bounds —
Overlay bounding rectangle in bitmap coordinates.
|
| getContentStyle | () | method |
public function getContentStyle():TextStyleReturns TextStyle that is applied to the content Text Field.
ReturnsTextStyle |
See also
| getDefaultStyle | () | method |
public static function getDefaultStyle():InfoWindowStyleReturns the default InfoWindowStyle object that will be assigned to the newely created info window.
ReturnsInfoWindowStyle —
The default style.
|
| getScrollBarClass | () | method |
public static function getScrollBarClass():ClassReturns the class that is used as a scroll bar for the info window.
ReturnsClass |
| getStyle | () | method |
public override function getStyle():ObjectReturns the InfoWindowStyle object associated with the info window.
ReturnsObject |
See also
| getTitleStyle | () | method |
public function getTitleStyle():TextStyleReturns TextStyle that is applied to the title Text Field.
ReturnsTextStyle |
See also
| hide | () | method |
public override function hide():void
Hides overlay.
Fires OverlayEvent.HIDE & OverlayEvent.CHAGNED events if visibility has been changed.
| isOpen | () | method |
public function isOpen():BooleanReturns a Boolean value which indicates whether info window is opened.
ReturnsBoolean — A value of true if info widow is opened at the moment; false if it is not.
|
| move | () | method |
public function move(x:Number, y:Number):voidParameters
x:Number |
|
y:Number |
| open | () | method |
public function open(param:Object = null, style:Object = null):void
Opens the info window.
When opnening the info window, you can override info window paramters via param object.
You can also specify new info window style via the style parameter.
Here is a list of properties you can specify in the param object:
| Property | Type | Default | Description |
|---|---|---|---|
title |
String |
"" | Specifies text that should be displayed in the title text field. |
content |
String |
"" | Specifies text that should be displayed in the content text field. |
offset |
Point |
(0,0) | Specifies offset distance of the info window's hot spot. |
autoClose |
Boolean |
true | A flag that defines whether info window should close automatically when user clicks the map. |
autoPan |
Boolean |
true | A flag that defines whether infoWindow should pan automatically to fit inside the map view. |
position |
LatLng |
(0,0) | Specifies info window's geographical position. |
param:Object (default = null) — Object that holds all the properites of an info window you wish to override.
|
|
style:Object (default = null) — Object that defines window's style.
|
| redraw | () | method |
public override function redraw():voidRedraws the overlay.
Override this method in your subclass and call super.redraw()
immediately before actual redraw so that OverlayEvent.BEFORE_REDRAW event will be automatically fired.
At the end of your drawing don't forget to manually fire OverlayEvent.REDRAW event.
| refresh | () | method |
public override function refresh(full:Boolean = false):void
Refreshes overlay position on the map.
If the full paramter is set to true then bitmap coordinates for this overlay are recalculated.
Otherwise overlay will be repositioned using previuosly calculated coordinates.
full:Boolean (default = false) — Indicates whether to perform full refresh.
|
| reset | () | method |
public function reset():voidResets the style & data for panels. After that we wait for Event.CHANGE event from the panels and trigger resize() function.
| setContentStyle | () | method |
public function setContentStyle(param:Object):voidSets new style for the content Text Field.
Parametersparam:Object — that contains the properties of the TextStyle class you wish to overwrite.
|
See also
| setDefaultStyle | () | method |
public static function setDefaultStyle(style:Object):voidSets the default InfoWindowStyle object that will be assigned to the newely created info window.
Parametersstyle:Object — Object that contains the properties of the InfoWindowStyle class you wish to overwrite.
|
| setScrollBarClass | () | method |
public static function setScrollBarClass(scrollBarClass:Class):void
Sets the class that will be instantiated and
used as a scroll bar for the info window.
Typcially you should use UIScrollBar class, but you can design your own.
The text field which should be scrolled is passed to the scroll bar class via scrollTarget property.
To see the scroll bar you should also set InfoWindowStyle.scroll property to true.
scrollBarClass:Class — UIScrollBar or it's subclass.
|
import com.afcomponents.umap.styles.InfoWindowStyle; import com.afcomponents.umap.display.InfoWindow; import com.afcomponents.umap.types.Size; import fl.controls.UIScrollBar; // create new map var map:UMap = new UMap(); map.setSize(300,300); addChild(map); // define scroll bar class // don't forget to put UIScrollBar component into the library InfoWindow.setScrollBarClass(UIScrollBar); // define info window style var style:InfoWindowStyle = new InfoWindowStyle(); style.scroll = true; style.maxSize = new Size(300, 100); // define parameters var param:Object = new Object(); param.title = "My Info Window"; param.content = "This is a very\nlong description\nto show you\nthe usage of scroll bar class\ndon't forget\nto have UIScrollBar in your library"; // open new info window var info:InfoWindow = map.openInfoWindow(param, style) as InfoWindow;
| setStyle | () | method |
public override function setStyle(param:Object):voidSets a new style for the Info Window.
Parametersparam:Object — that contains the properties of the InfoWindowStyle class you wish to overwrite.
|
See also
| setTitleStyle | () | method |
public function setTitleStyle(param:Object):voidSets new style for the title Text Field.
Parametersparam:Object — that contains the properties of the TextStyle class you wish to overwrite.
|
See also
| show | () | method |
public override function show():void
Shows overlay.
Fires OverlayEvent.SHOW & OverlayEvent.CHAGNED events if visibility has been changed.