如果我错过了一些基本知识的话,我对这个话题感到非常抱歉。
我想用AdobeExtensionBuilder2.1在FlashBuilder4.6中做一个adobe首创的CC扩展,并且我想让应用程序逻辑远离设计。
我读过Flex: How to keep code away from MXML,我知道模式背后的代码是如何工作的,但我不知道如何在创建扩展时做到这一点。
我启动了一个新的
project1Premiere.as
package
{
import com.adobe.csawlib.premiere.Premiere;
import com.adobe.csxs.types.Extension;
import com.adobe.premiere.*;
import spark.components.TextInput;
//re-declaring txt declared in project1.mxml
public var txt:spark.components.TextInput;
//Use CSExtension rather than WindowedApplication, as the base application
//class for extensions.
//This class previously was project1Premiere
public class CSExtension extends Extension
{
public static function run():void
{
var app:App = Premiere.app;
//your Premiere code here
txt.text = "testing...";
}
}
}
project1.mxml
<?xml version="1.0" encoding="utf-8"?>
<csxs:CSExtension xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:csxs="com.adobe.csxs.core.*" applicationComplete="appComplete()">
<fx:Script>
<![CDATA[
import com.adobe.csxs.core.CSInterface;
[Bindable]
private var hostName:String = HostObject.mainExtension;
public function appComplete():void{
CSInterface.instance.autoThemeColorChange = true;
}
]]>
</fx:Script>
<s:VGroup height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
<s:Button label="Run PR code" click="project1Premiere.run()" enabled="{hostName.indexOf('premiere') > -1}"/>
<s:TextInput id="txt"/>
</s:VGroup>
我发现了这个错误:
在源路径中找到的文件不能有多个外部可见定义.project1Premiere.as /project1/src
我是否在.mxml文件的根目录中遗漏了一些引用.as的属性?
提前谢谢你,
菲利普。
发布于 2014-11-05 16:00:44
我完全不想回答这个问题,但我想试一试。改变public var txt:spark.components.TextInput;
至
public var txt:spark.components.TextInput = new spark.components.TextInput;
有什么改变吗?我只阅读了一些关于某些公共类的内容,这些类不需要使用new
操作符实例化,而是能够动态添加属性。如果TextInput不是这些类中的一个,那么它在以后没有创建实例的情况下就会成为.text
属性,这可能会导致问题。我不完全明白,但这并不是在黑暗中的一次彻底的刺。
https://stackoverflow.com/questions/26754191
复制相似问题