0

我已将我的脚本更新为下面提到的内容,但我仍然收到相同的语法错误......有什么建议吗?

<fx:Script>
<![CDATA[
    try {
        URL url = new URL("http://www.rwolfc.com/App/TRY.txt"){;
        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
        String str;
        while ((str = in.readLine()) != null) {
        }
        in.close();
    } catch (MalformedURLException e) {
    } catch (IOException e) {
    }
]]>


    </fx:Script>            

但是当我使用它时,我在 flex 中得到以下错误:

1071: Syntax error: expected a definition keyword (such as function) after attribute String, not str.
1073: Syntax error: expecting a catch or finally clause.
1084: Syntax error: expecting rightbrace before leftbrace.

帮助!!??!!

4

1 回答 1

1

在以下行中,您没有将结果分配给变量

URL = new URL("http://www.rwolfc.com/App/TRY.txt");

它应该是

URL url = new URL("http://www.rwolfc.com/App/TRY.txt");
于 2012-10-19T19:43:11.167 回答