Scripting Components
Is is possible to create components via ActionScript instead of MXML? Are there any examples/docs you can push to me?
Thanks
Jef
Hi Jef,
your speaking of the RotatingListFX ?
Basically a rotating list is just a container. So you could do...
var list:RotatingListFX = new RotatingListFX(); var myPane:ListPaneFX = new ListPaneFX(); myPane.addChild(new List()); list.addChild(myPane); // tile it to start list.titleList();
Is that what you were looking for?
Mike
Well I got this code to compile but receive the following runtime error. Unfortunately, googling the error didn't turn up anything relevant.
"TypeError: Error #2007: Parameter child must be non-null."
My Code:
var rl:RotatingListFX = new RotatingListFX();
// create the new pae
var pane1:ListPaneFX = new ListPaneFX();
pane1.title = "Pane 1";
// add a button to the pane
var b:Button = new Button();
b.label = "My Button 1";
b.id = "btn1";
pane1.addChild(b);
// add the pane to the rotating list
rl.addChild(pane1);
// tile it to start
rl.tileList();
// add the rotating list to the canvas
myCanvas.addChild(rl);
Hi Jef,
private function init():void { var rl:RotatingListFX = new RotatingListFX(); rl.percentWidth = 100; rl.percentHeight = 100; // create the new pae var pane1:ListPaneFX = new ListPaneFX(); pane1.title = "Pane 1"; var pane2:ListPaneFX = new ListPaneFX(); pane2.title = "Pane 2"; // add a button to the pane var b:Button = new Button(); b.label = "My Button 1"; b.id = "btn1"; pane1.addChild(b); // add the pane to the rotating list rl.addChild(pane1); rl.addChild(pane2); // add the rotating list to the canvas addChild(rl); }
There seems to be a minor problem with component when you only add one child through actionscript to start with.
I have tested the below and it works fine.
I will look into this.
Mike

Joined: 2008-05-01