2014-11-05 77 views
0

我是新来这个主题,所以很抱歉,如果我缺少一些基本知识。代码背后的问题(Adobe Premiere CC扩展)

我想使用Adobe Extension Builder 2.1在Flash Builder 4.6中创建Adobe Premiere CC扩展,并且我想让应用程序逻辑远离设计。

我已阅读Flex: How to keep code away from MXML,我知道代码隐藏模式如何工作,但我不知道如何在创建扩展时执行此操作。

我开始了新的Adobe应用程序扩展项目

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> 

和我发现此错误:

在源路径中找到的文件不能有多个外部可见的定义。 txt; CSExtension project1Premiere.as/project1/src

我错过了.mxml文件根目录中的某些属性来引用.as?

在此先感谢,

Filip。

回答

0

我完全不在我的联盟试图回答这个问题,但我想给它一个镜头。 是否改变public var txt:spark.components.TextInput;

public var txt:spark.components.TextInput = new spark.components.TextInput;

改变什么? 我读了一些关于某些常见的类,不需要用new运算符实例化,但能够动态地添加属性。如果TextInput不是其中的一个类,则在稍后创建.text属性而不创建实例可能会导致问题。我不完全理解它,但它不是在黑暗中完成的。

+0

我决定把我的逻辑放到project1.mxml文件中,现在我会尝试在后期分离逻辑和设计... 谢谢反正 – 2014-11-10 11:11:55