I have some cube primitive wich have MovieMaterial generates by
Menu.as
Here is the code of Menu.as:
package
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldType;
[SWF(width="400", height="100", frameRate="30",
backgroundColor="0x000000", quality="high")]
public class Menu extends Sprite
{
private var xml:XMLLoad=new XMLLoad();
public var str:String=new String();
public function Menu(ar:Array=null)
{
var rect:Shape=new Shape();
rect.graphics.lineStyle(2, 0x000000);
rect.graphics.beginFill(0xadcbfa);
rect.graphics.drawRect(0,0, 400, 100);
addChild(rect);
for (var i:int=0; i<ar.length; i++)
{
var txt:TextField=new TextField();
txt.x=10+i*70;
txt.y=10;
txt.background=true;
txt.border=true;
txt.borderColor=0x000000;
txt.backgroundColor=0xFFFFFF;
txt.alwaysShowSelection=true;
txt.width=60;
txt.height=20;
txt.maxChars=6;
txt.type=TextFieldType.INPUT;
txt.text=ar[i];
//txt.addEventListener(Event.CHANGE,
setPlayerNames);
addChild(txt);
}
}
/*public function setPlayerNames(e:Event):void
{
str=e.target.text;
}*/
}
}
and have the class in which I create my cube primitive Objects.as
c=new Cube({width:400, height:400});
c.material=new MovieMaterial(new Menu(array), {interactive:true,
precision:5, smooth:true, lockW:400, lockH:100, rotation:0});
Everything works great, BUT How can I get text, from TextFields which
were created in Menu.as? Is it possible?