0

i am new to this topic so sorry if i am missing some basics.

i want to make a adobe premiere CC extension in Flash Builder 4.6 with Adobe Extension Builder 2.1, and i want to keep the application logic away from the design.

I have read Flex: How to keep code away from MXML and i know how Code Behind pattern works, but i don't know how to do this while creating a Extension.

i started a new Adobe Application Extension Project

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>

and i found this error:

A file found in a source-path can not have more than one externally visible definition. txt;CSExtension project1Premiere.as /project1/src

am i missing some attribute in root of .mxml file to reference the .as ?

Thanks in advance,

Filip.

Community
  • 1
  • 1

1 Answers1

0

I'm completely out of my league trying to answer this but I'd like to give it a shot. Does changing public var txt:spark.components.TextInput;

to

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

change anything? I read something about only certain common classes not needing to be instantiated with the new operator but being able to have properties added dynamically. If the TextInput isn't one of those classes setting it's .text property later on without creating an instance might cause the problem. I don't completely understand it but it's not a complete stab in the dark.

Scab
  • 28
  • 6
  • i decide to put my logic into project1.mxml file for now...i will try to separate logic and design in later stages... thanks anyway – Filip Kantaro Nov 10 '14 at 11:11