Hi Tracy,
Oh if only it were that easy!! Looks like it's gonna have to be much
deeper....here's why...
A project manager can have any number of projects they run...
The dashboard is setup so they have access to all their projects via
one dashboard....
Basically, when they login, I get a list of all the projects they
manage....and then create a simple viewStack with tabNavigator, one tab
for each of the projects they run. Each tab has the "same" widgets, only
loaded with the data specific to the project for the tab they are
looking at (much akin to having several tabs opened in Firefox, all of
them on Amazon, yet on each one, I'm looking for a book different from
the other tabs.)
The widgets are simple stand-alone apps that are repatedly used in
each tab...i.e. projectStatistics.swf is used once on every tab (i.e.
for every project) on the dashboard. For each instance of the widget,
it needs to know the project name so it can query the data for that
specific project.
All of this is created dynamically in my actionscript (will paste
below). In addition, the user can customize (and persist in the db)
their widget configuration for each project (tab). So, with my 3-column
layout, they might have, on [Tab1] Project 1, column 1, Widgets A, C
and D while on [Tab2] Project 2, column 1, Widgets A, B, F, Q. All of
this persistence is read from the database upon their login and the code
simply builds their dashboard, tabs and widgets based on their last know
setup.
Since this is so dynamic, I don't think I can get away with trying
to access any static public variables via application.application. I've
taken a look at your example on cflex.net on manipulating the .content
property, but it looks like I need to specifically reference each of the
loaded widgets, which is not very simple considering their dynamic
loading...
Any other ideas? And I cannot seem to find much regarding the data
model in flex you mentioned...
Best,
Adrian
private function
getGapWidgetConfigurationsResult(event:ResultEvent):void
{
gapWidgetConfigs = event.result as ArrayCollection;
buildViewstack();
}
private function buildViewstack():void
{
for each (var project:Object in projectsArray)
{
var projectName:String = project.label;
var newCanvas:Canvas = new Canvas();
newCanvas.id = "canvas" + projectName;
newCanvas.label = projectName;
newCanvas.percentHeight = 100;
newCanvas.percentWidth = 100;
dashboardMainViewstack.addChild(newCanvas);
var newHBox:HBox = new HBox();
newHBox.id = "hbox" + projectName;
newHBox.percentHeight = 100;
newHBox.percentWidth = 100;
newCanvas.addChild(newHBox);
for (var i:int = 0; i < 3; i++)
{
var newVBox:VBox = new VBox();
newVBox.id = "col" + i + projectName;
newVBox.percentWidth = 33;
newVBox.percentHeight = 100;
newVBox.setStyle("borderStyle", "solid");
newVBox.setStyle("borderThickness", "1");
newVBox.setStyle("cornerRadius", "4");
newVBox.setStyle("horizontalAlign", "center");
newVBox.setStyle("horizontalCenter", "0");
newVBox.setStyle("paddingTop", "5");
newVBox.setStyle("paddingBottom", "5");
newVBox.setStyle("backgroundColor", "#FCF3D3");
newVBox.addEventListener(MouseEvent.MOUSE_DOWN,setMouseDownTrue);
newVBox.addEventListener(MouseEvent.MOUSE_UP,setMouseDownFalse);
newVBox.addEventListener(DragEvent.DRAG_ENTER,checkAndHandleDE);
newVBox.addEventListener(DragEvent.DRAG_DROP,checkAndHandleDD);
newHBox.addChild(newVBox);
for each (var widgets:Object in gapWidgetConfigs)
{
if (widgets.DisplayColumn == i + 1 &&
widgets.BcgGroup == projectName && widgets.Active == 1)
{
var newPanel:SuperPanelPlus = new
SuperPanelPlus();
newPanel.id = widgets.PanelId;
newPanel.title = widgets.Title;
newPanel.y = 0;
newPanel.percentHeight = widgets.Height;
newPanel.percentWidth = 98;
newPanel.collapsed = widgets.IsCollapsed;
newPanel.layout = "absolute";
newPanel.setStyle("horizontalAlign",
"center");
newPanel.setStyle("fontFamily", "Arial");
newPanel.setStyle("fontSize",
"{currentFontSize}");
newPanel.resizeEnabled = true;
newPanel.showControls = true;
newPanel.resizeHeightEnabled = true;
newPanel.styleColor = widgets.StyleColor;
newPanel.addEventListener(DragEvent.DRAG_ENTER,handleDragEnter);
newPanel.addEventListener(DragEvent.DRAG_DROP,handleDragDrop);
newPanel.addEventListener(DragEvent.DRAG_COMPLETE,handleDragComplete);
newPanel.addEventListener("closeClickEvent",closeWindow);
newPanel.addEventListener(MouseEvent.MOUSE_MOVE,dragInit);
newVBox.addChild(newPanel);
var newWidget:SWFLoader = new SWFLoader();
newWidget.id = "widget_" + widgets.Id;
newWidget.source = widgets.Source;
newWidget.percentHeight = 100;
newWidget.percentWidth = 100;
newPanel.addChild(newWidget);