Scripting Components

jeffdonthemic
Posts: 2
Joined: 2008-05-01

Is is possible to create components via ActionScript instead of MXML? Are there any examples/docs you can push to me?

Thanks
Jef

Comments
Teoti
Posts: 171
Joined: 2006-09-04

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

jeffdonthemic
Posts: 2
Joined: 2008-05-01

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);

Teoti
Posts: 171
Joined: 2006-09-04

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

Privacy Policy | Copyright Notice| Disclaimer| Product EULA
©2003-2008 Teoti Graphix, LLC - All rights reserved.