2014-11-05 82 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