问题描述
为了达到以下目的:
我试图使用acompc
和mxmlc
,但是我无法实现上述方法。
最近,我遇到了Visual Studio Code(VSC)的as3mxml插件,我尝试了一下,因为至少有一些示例。这是我的MVP:
构建library
,library.swf
和library.swc
的项目catalog.xml
src/Common/Label.as
:
package Common {
import flash.display.Sprite;
import flash.text.TextField;
public class Label extends Sprite {
public function Label(text:String,x:Number,y:Number) {
var display_txt:TextField = new TextField();
display_txt.text = text;
display_txt.x = x;
display_txt.y = y;
addChild(display_txt);
}
}
}
asconfig.json
:
{
"type": "lib","compilerOptions": {
"swf-version": 11,"source-path": [
"src"
],"include-sources": [
"src"
],"warnings": false,"debug": false,"use-network": false,"output": "bin/library.swc"
}
}
该库以我想要的方式构建,因此这里似乎没有问题。
构建HelloWorld
的项目HelloWorld.swf
src/HelloWorld.as
:
package {
import flash.display.MovieClip;
import flash.text.TextField;
import Common.Label;
public class HelloWorld extends MovieClip {
public function HelloWorld() {
var label:Label = new Label("Hello World",5,5);
addChild(label);
}
}
}
asconfig.json
:
{
"config": "air","external-library-path": [
"../library/bin/library.swc"
],"static-link-runtime-shared-libraries": false,"output": "bin/HelloWorld.swf"
},"mainClass": "HelloWorld"
}
通过此设置,VSC成功完成了Label
类的代码完成,library
和HelloWorld
的构建成功,但是HelloWorld.swf
没有与库的链接。 / p>
但是,如果我要将external-library-path
中的library-path
更改为HelloWorld/asconfig.json
,则来自library
的代码将被嵌入HelloWorld.swf
内,而不是预期的方式。我期望HellowWorld.swf
显式导入library.swf
(通过ImportAssets
标签)。我尝试了调整库导入方式和静态链接的方法,但是没有一种方法导致想要的行为。
我该如何实现?
其他问题:编译器不断编译为CWS
,我怎么能不压缩地编译它?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)