Event Object¶
The Event object contains properties about the context of the caller of a callback function.
How to get the Event object
The Event object is passed as the only parameter to every callback function.
You can also get the Event object by calling the MapsAlive getEvent
method.
Event Object Properties¶
- event.action
- The action that triggered the callback. The “click”, “mouseout”, and “mouseover” actions are specified on the Marker Actions screen. The “livedata” action is specified on the Advanced Hotspot Options screen.
- event.api
- The API object that called the function. You can use this object to make calls back to the API.
- event.hotspot
- Properties for the hotspot associated with the action. Not present if there is no hotspot associated with the action.
- event.hotspot.id
- The Id from the Edit Hotspot Content screen.
- event.hotspot.title
- The title from the Edit Hotspot Content screen.
- event.instance
- Instance identifier specified using the
instance
tour setting for an embedded tour. - event.instanceId
- Position of the tour instance in the containing web page. The value is 1 for the first tour on the page, 2 for the second tour, and so on.
- event.page
- Properties for the current page. Not present if there is no page associated with the action.
- event.page.id
-
Page Id from one of the following:
- Advanced Map Options screen
- Advanced Gallery Options screen
- Edit Data Sheet Content screen
- event.page.name
-
Page name from one of the following:
- Map Setup screen
- Gallery Setup screen
- Edit Data Sheet Content screen
- event.page.number
- Page number.
- event.page.title
-
Page title from one of the following:
- Advanced Map Options screen
- Advanced Gallery Options screen
- Edit Data Sheet Content screen
- event.response
- Properties for the response to a Live Data request. Not present if the event is not for Live Data. See the
onEventLiveDataResponse
callback function for more detailed information about the response properties. - event.response.count
- The number of callbacks to
onEventLiveDataResponse
so far in response to a prior call to the requestData method. You can compare this value toevent.response.total
to determine if a callback has occurred for all of the hotspots requested. - event.response.data
-
When
event.response.error
is false, the value be one of the following, otherwise it will be the text of the error message.- If the request was for text, the data will be the text.
- If the request was for JSON, the data will be a JSON object.
- If the request was for XML, the data will be the text content of the
<data>
element or an empty string if the element has no content. If the<data>
element contains XML, the data will beundefined
and the XML will be inevent.response.xml
.
- event.response.error
- Normally false, but true if a server error occurred while retrieving the data. The error message will be provided as the value of the
event.response.data
. - event.response.hotspotId
- The hotspot Id for a response received for a prior call to the requestData method, otherwise, zero.
- event.response.xml
- If the request was for XML, this will be the XML for the
<data>
element, otherwise, it will be null. - event.response.requestId
- A string that you provided when you made the request. If your code only makes one kind of request, you won’t need to examine this value, but if you are making different requests for different kinds of data, you can use the value to determine which kind of request the data is for. For example, one request might be to get information about hotspots and another might be to get a message that will be displayed to the user.
- event.response.total
- The total number of hotspots returned from the server in response to a prior call to the requestData method.
- event.tourName
- Tour name from the Tour Setup screen.
- event.tourNumber
- Tour number from the Tour Manager screen.