This example shows how to create report viewer from code in runtime. First you need to create the new viewer object of the StiViewerFx class. Also you can set necessary parameters of the viewer object, for example its position. After creation you can add the viewer visual object to the main container of the application using the addElement() method:

private var _viewer: StiViewerFx;
public function get viewer(): StiViewerFx
return _viewer;
public function set viewer(value: StiViewerFx): void
_viewer = value;

private function createViewerFx(): void
// Create new ViewerFx
viewer = new StiViewerFx;
// Set ViewerFx location
viewer.left = 0; = 0;
viewer.right = 0;
viewer.bottom = 0;
// Hide Close button on viewer toolbar
StiOptions.viewer.toolbar.showExitButton = false;
// Add ViewerFx to Application

To use this instance of the report viewer, you can access to the viewer property:

private function onLoadComplete(event: Event): void

// Create new report object
var report: StiReport = new StiReport();
// Load document from XML string
// Show report in ViewerFx = report;

In the screenshot below you can see the result of the sample code.

Create the Viewer in Runtime