我已经搜索了网络,但我找不到我的问题的答案。我正在构建一个读取 txt 文件并将它们显示在空中应用程序中的空中应用程序,但出于一个奇怪的原因,我在同一行出现了 2 个错误。
错误:
-1067:将 void 类型的值隐式强制转换为不相关的类型 Function。
-1067:将 Class 类型的值隐式强制转换为不相关的类型 flash.events:Event。
编码:
public function init():void {
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
public function txtReeks1_creationCompleteHandler():void {
var url:String = "Files/Reeks1.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler(Event));
loadit.load(new URLRequest(url));
}
public function completeHandler(event:Event):void {
txtReeks1.text = event.target.data;
stripLinesFromTextArea(txtReeks1);
}
public function stripLinesFromTextArea(textArea:TextArea):void {
var txt:String = textArea.text;
var re:RegExp = /\n+/g;
txt = txt.replace(re,"");
textArea.text = txt;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:TabNavigator x="0" y="0" width="100%" height="100%">
<mx:Canvas id="Reeks1" width="100%" height="100%" label="Reeks1">
<mx:TextArea id="txtReeks1" x="0" y="0" width="100%" height="100%"
creationComplete="txtReeks1_creationCompleteHandler()"
fontFamily="Lucida Console" fontSize="20"/>
</mx:Canvas>
<mx:Canvas id="Reeks2" width="100%" height="100%" label="Reeks2">
</mx:Canvas>
<mx:Canvas id="Reeks3" width="100%" height="100%" label="Reeks3">
</mx:Canvas>
</mx:TabNavigator>
</mx:WindowedApplication>
我希望有人可以帮助我,因为我在过去 2 天里正在寻找答案