我試圖訪問我已經放在舞臺上(在影片剪輯內)但沒有運氣的文本輸入。如何從文檔類訪問舞臺上的動態文本字段
我已經爲這個動態文本字段是currentUserCount定義的實例名稱
我有這樣的事情在文檔類ActionScript文件設置:
package {
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
public class myProject extends Sprite {
public function myProject() {
// Trying stuff like
trace(currentUserCount);
trace(movieClipName.currentUserCount);
trace(root.currentUserCount);
}
}
}
我在想什麼?
當我運行此我得到:
1120: Access of undefined property currentUserCount.
1120: Access of undefined property movieClipName.
1119: Access of possibly undefined property movieClipName through a reference with static type flash.display:DisplayObject.
1120: Access of undefined property currentUserCount.
您是否收到任何編譯器錯誤?跟蹤movieClipName時會發生什麼? – 2010-09-02 18:48:03
我已經添加了編譯器輸出 – arnorhs 2010-09-02 18:56:17
沒有看到.fla,很難得到一個好主意,但我的猜測是movieclip沒有實例名稱。 – 2010-09-02 19:06:13