Task 9: Create the dataXML variable and pass the data
As described earlier in this chapter, one of the ways to pass data to a Flash object is through the dataXML variable. In this procedure, create the dataXML variable and assign the XML content to the variable.
1 In the report layout, select the Flash object.
2 In Property Editor, choose Flash Variables, as shown in
Figure 15‑18.
Figure 15‑18 Flash Variables tab in Property Editor
3 Choose Add.
4 In Add Variables, do the following:
1 In Name, type:
dataXML
2 In Expression, choose the JavaScript expression builder.
5 In the JavaScript expression builder, type the following expression:
var g_dataPart = reportContext.getPersistentGlobalVariable("g_dataPart");
"<map><data>" + g_dataPart + "</data></map>"
The first statement retrieves the XML data string that you created earlier and stored in the persistent global variable g_dataPart. The second statement builds a bare-bones XML data document that contains only the essential elements. This line creates the required <map> and <data> elements, and appends the g_dataPart variable, which supplies the <entity> data. The XML does not include any formatting attributes.
6 Choose OK.
7 Choose Preview. The previewer displays the Flash map. Move the mouse pointer over each continent. A tooltip displays the continent’s full name and the sales total for that continent (if sales data exists for the continent), as shown in
Figure 15‑19. This Flash map uses all the default data and formatting attributes.
Figure 15‑19 Preview of the Flash map with the mouse pointer over Europe