Dashboard.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:managers="com.esria.dashboard.managers.*"
applicationComplete="onApplicationComplete()"
viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import com.esria.dashboard.managers.StateManager;
import com.esria.dashboard.view.Pod;
import com.google.code.flexiframe.IFrame;
import mx.events.FlexEvent;
// Stores PodLayoutManagers keyed off of a Pod.
// Used for podLayoutManager calls after pods have been created for the first time.
// Also, used for look-ups when saving pod content ViewStack changes.
private var podHash:Object = new Object();
private function onApplicationComplete():void
{
for (var i:int = 0; i < 4; ++i) {
var pod:Pod = new Pod();
pod.id = "pod" + i;
pod.title = "IFrame " + i;
pod.allowMinimize = true;
pod.allowMaximize = true;
pod.allowClose = true;
podHash[pod.id] = pod;
layoutmanager.addItemAt(pod, i, false);
}
var content:IFrame = new IFrame("frame0");
content.percentHeight = 100;
content.percentWidth = 100;
content.source = "http://www.google.com";
content.overlayDetection = true;
podHash["pod0"].addChild(content);
var content2:IFrame = new IFrame("frame1");
content2.percentHeight = 100;
content2.percentWidth = 100;
content2.source = "http://www.yahoo.com";
content2.overlayDetection = true;
podHash["pod1"].addChild(content2);
var content3:IFrame = new IFrame("frame2");
content3.percentHeight = 100;
content3.percentWidth = 100;
content3.source = "http://code.google.com/p/flex-iframe";
content3.overlayDetection = true;
podHash["pod2"].addChild(content3);
var content4:IFrame = new IFrame("frame3");
content4.percentHeight = 100;
content4.percentWidth = 100;
content4.source = "http://code.google.com/p/flex-iframe/updates/list";
content4.overlayDetection = true;
podHash["pod3"].addChild(content4);
// Listen for the last pod to complete so the layout from the ContainerWindowManager is done correctly.
pod.addEventListener(FlexEvent.UPDATE_COMPLETE, onCreationCompletePod);
}
// Pod has been created so update the respective PodLayoutManager.
private function onCreationCompletePod(e:FlexEvent):void
{
e.currentTarget.removeEventListener(FlexEvent.UPDATE_COMPLETE, onCreationCompletePod);
layoutmanager.removeNullItems();
layoutmanager.updateLayout(false);
}
]]>
</mx:Script>
<mx:Style source="assets/dashboard.css" />
<mx:ApplicationControlBar dock="true">
<mx:Text selectable="false">
<mx:htmlText><![CDATA[<font color="#000000" size="12"><b>Flex-IFrame - Dashboard example</b><br>This example shows several IFrames at the same time.</font>]]></mx:htmlText>
</mx:Text>
</mx:ApplicationControlBar>
<managers:PodLayoutManager id="layoutmanager"
container="{maincanvas}"
update="StateManager.setPodLayout(event)" />
<mx:Canvas id="maincanvas"
width="100%"
height="100%"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"/>
</mx:Application>