flex新手的一个小问题
小弟新手,刚学一天。问题是动态的创建文本框!!!!!看代码吧
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="initApp()">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.TextInput;
private function createTextInput(id:String,text:String,x:Number,y:Number):TextInput{
var textInput:TextInput=new TextInput();
textInput.id=id;
textInput.text=text;
textInput.x=x;
textInput.y=y;
return textInput;
}
private function initApp():void{
for(var i:int=1;i<10;i++){
this.addChild(createTextInput(i.toString(),"文本框"+i.toString(),50,i*30));
}
}
]]>
</fx:Script>
</s:Application>
帮我看看这个代码的问题在什么地方 ?为什么创建的就是个白板,没按我预期显示。
这个addChild怎么用
新手没分 希望各位能谅解