Hi Everyone,

 We have an existing Flex App, that creates dashboards on the fly 
that pull data from http services.  It's a beautiful thing as a real 
working, "live" application.  However, creating an environment where 
such an app can be delivered or at least demo'ed entirely "offline" 
is a challenge.  The problem is that both the layout and the data 
need to be rendered at runtime, not design time.  The 
article "Dynamically Creating User Interface Components" is a small 
scale example of this.

http://www.macromedia.com/devnet/flex/articles/flexprimer_03.html


 I'm looking to recreate some of the Flex controls in Flash.  I 
understand that the flexforflash.zip is both outdated and deprecated 
in functionality, but conceptually it would be possible to reuse 
these components back in the Flash environment, provided we 
populated the components with the correct initial objects, etc.  I 
also understand this would probably require implementing a large 
portion of the Flex Framework back into Flash, but it seems like 
early on Flex v1.0 some of this may have been done by providing the 
flexforflash.zip in the first place.  For example the FlexforFlash, 
contained mx.core.Application, mx.containers.Panel, etc.  How would 
one go about using these components since they were provided...?

I've cobbled together the following example, but after tracing, I 
realize that my properties aren't getting populated properly, and 
the Panel isn't rendering correctly.

Let me show the code below:

import mx.core.Application;
import mx.containers.Canvas;
import mx.containers.Panel;
import mx.charts.PieChart;

trace("ROOT PROTO:"+_root.__proto__);

// Init Object, App, Canvas, Panel...

var MyApplication:Object = null;
var pnl:Object = null; //mx.containers.Panel
var cnv:Object = null; //mx.containers.Canvas
var init:Object = null;
var pChart:Object = null; //mx.charts.PieChart

MyApplication = new mx.core.Application();
trace("myApplication:"+MyApplication);
this.__proto__ = MyApplication;
if (!(this.constructObject == undefined)) {
        this.constructObject();
} else {
        trace("COULD NOT FIND CONSTRUCTOBJECT");
}
trace("Application:"+application); // Static Var should show ref?

init = new Object();
init.id = "CANVAS";
init.borderStyle = "none";
init.x = "10";
init.y = "30";
init.width = "800";
init.height = "600";

cnvs = createChild(mx.containers.Canvas, "cnvs", init) ;
//cnvs.invalidate();

init = new Object();
init.id= "PANEL1";
init.x = "0.0";
init.y = "0.0";
init.width = "328.0";
init.height = "296.0";
init.title = "Output Chart";
init.headerHeight = 21;
init.shadowDirection = "right";
init.panelBorderStyle = "roundCorners";
//init.cornerRadius = "3";
//init.dropShadow = "true";
init.headerColors = "[0xE1E5EB, 0xF4F5F7]";
init.footerColors = "[0xF4F5F7, 0xE1E5EB]";

// Had prev. cast as Panel(createCh...), but same results
pnl = cnvs.createChild(mx.containers.Panel, "pnl", init) ; 

pnl.invalidate();

trace("Panel:"+pnl);
trace("Panel:"+pnl.id);
trace("Panel:"+pnl.title);
trace("Panel:"+pnl.width);
trace("Panel:"+pnl.height);
//trace("Panel:"+pnl.headerHeight);


init = new Object();
init.id = "piechart1";
init.x = "421";
init.y = "735";
init.dataprovider = "";

pChart = pnl.createChild(mx.charts.PieChart, "pChart", init) ;
pChart.invalidate();

trace("PieChart:"+pChart);
trace("PieChart:"+pChart.id);
trace("PieChart:"+pChart.x);
trace("PieChart:"+pChart.y);
stop();

TRACE OUTPUT:

ROOT PROTO:[object Object]
myApplication:[object Object]
Application:undefined
Panel:_level0.cnvs.pnl
Panel:PANEL1
Panel:Output Chart
Panel:100   *****SHOULD BE 0
Panel:100   *****SHOULD BE 0
PieChart:_level0.cnvs.pnl.pChart
PieChart:piechart1
PieChart:0  *****SHOULD BE 421
PieChart:0  *****SHOULD BE 735


Any thoughts would be greatly appreciated!
Thanks,
Jason






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to