Adobe Animate CC ActionScripts3错误

时间:2017-01-15 07:21:33

标签: actionscript-3

我正在尝试在Animate CC 2017中使用StageWebView,在测试时显示以下错误:

“场景1,图层'第1层',第1帧,第1行,第10列1037:包不能嵌套。”

文档为空,在第1帧中我添加了代码。

 package { 
    import flash.display.*; 
    import flash.geom.Rectangle; 
    import flash.media.StageWebView; 
    public class WebView extends Sprite 
    { 
        public var webView:StageWebView = new StageWebView(); 
        public function WebView() 
        {     
            var htmlString:String = "<!DOCTYPE HTML>" + 
            "<html><script type=text/javascript>" + 
            "function callURI(){" + 
            "alert(\"You clicked me!!\");"+ 
            "}</script><body>" + 
            "<p><a href=javascript:callURI()>Click Me</a></p>" + 
            "</body></html>"; 
            webView.stage = this.stage; 
            webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ); 
            webView.loadString( htmlString ); 
        } 
    } 
}

0 个答案:

没有答案