0
我在影片剪輯添加textfield
並添加得到文本的底色bg.Here是該代碼::從文本框
box = new boxMc();
bg.addChild(box);
box.x=boxX;
box.y=boxY;
exampleText="<p class='sarath'>"+k+"</p>";
boxVal = new TextField()
box.addChild(boxVal);
boxVal.styleSheet=sheet;
boxVal.htmlText=exampleText;
boxX=boxX+28
boxArray.push(box)
現在我想以檢索從文本框中boxVal
文本..和我試過如下::
for(var j:Number =0;j<boxArray.length;j++)
{
var mc:MovieClip = boxArray[j] as MovieClip;
trace(mc.getChildAt(1).text)
}
當我跟蹤mc.getChild(1)
,它顯示爲TEXTFIELD
,但trace(mc.getChildAt(1).text)
給了我下面的錯誤
1119: Access of possibly undefined property text through a reference with static type flash.display:DisplayObject.
嘗試'TextField(mc.getChildAt(1)).txt' – putvande
Thankyou @putvande – user2862947