第一步:新建一个Adobe Appilcation Extension Project 项目工程
第二步:默认勾选Illustrator和Adobe CSXS SWC点击完成 建好一个空工程。
第三步:
下面开始加控件,加代码
<?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()">
<csxs:layout>
<s:BasicLayout/>
</csxs:layout>
<fx:Script>
<![CDATA[
import com.adobe.csxs.core.CSInterface;
[Bindable]
private var hostName:String = HostObject.mainExtension;
public function appComplete():void{
CSInterface.instance.autoThemeColorChange = true;
}
protected function button1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button2_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button3_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button4_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
]]>
</fx:Script>
<s:VGroup width="100%" height="100%" horizontalAlign="center" horizontalCenter="0"
verticalAlign="middle" verticalCenter="0">
<s:Panel width="250" height="200" title="UI面板">
<s:Button height="22" label="Run AI code" click="UILaodengNo1Illustrator.run()"
enabled="{hostName.indexOf('illustrator') > -1}" horizontalCenter="-5"
verticalCenter="61"/>
<s:HGroup width="120" height="50" horizontalAlign="center" horizontalCenter="-24"
verticalAlign="middle" verticalCenter="-52">
<s:Button width="50" height="50" label="1" click="button3_clickHandler(event)"
icon="@Embed('assets/measure.png')"/>
<s:Button width="50" height="50" label="2" click="button4_clickHandler(event)"
icon="@Embed('assets/measure(1).png')" skinClass="spark.skins.spark.ButtonSkin"/>
</s:HGroup>
<s:HGroup width="123" height="60" horizontalAlign="center" horizontalCenter="-25"
verticalAlign="middle" verticalCenter="8">
<s:Button width="50" height="50" label="3" click="button3_clickHandler(event)"
icon="@Embed('assets/more.png')"/>
<s:Button width="50" height="50" label="4" click="button4_clickHandler(event)"
icon="@Embed('assets/more.png')" skinClass="spark.skins.spark.ButtonSkin"/>
</s:HGroup>
</s:Panel>
</s:VGroup>
</csxs:CSExtension>
<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()">
<csxs:layout>
<s:BasicLayout/>
</csxs:layout>
<fx:Script>
<![CDATA[
import com.adobe.csxs.core.CSInterface;
[Bindable]
private var hostName:String = HostObject.mainExtension;
public function appComplete():void{
CSInterface.instance.autoThemeColorChange = true;
}
protected function button1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button2_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button3_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
protected function button4_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
]]>
</fx:Script>
<s:VGroup width="100%" height="100%" horizontalAlign="center" horizontalCenter="0"
verticalAlign="middle" verticalCenter="0">
<s:Panel width="250" height="200" title="UI面板">
<s:Button height="22" label="Run AI code" click="UILaodengNo1Illustrator.run()"
enabled="{hostName.indexOf('illustrator') > -1}" horizontalCenter="-5"
verticalCenter="61"/>
<s:HGroup width="120" height="50" horizontalAlign="center" horizontalCenter="-24"
verticalAlign="middle" verticalCenter="-52">
<s:Button width="50" height="50" label="1" click="button3_clickHandler(event)"
icon="@Embed('assets/measure.png')"/>
<s:Button width="50" height="50" label="2" click="button4_clickHandler(event)"
icon="@Embed('assets/measure(1).png')" skinClass="spark.skins.spark.ButtonSkin"/>
</s:HGroup>
<s:HGroup width="123" height="60" horizontalAlign="center" horizontalCenter="-25"
verticalAlign="middle" verticalCenter="8">
<s:Button width="50" height="50" label="3" click="button3_clickHandler(event)"
icon="@Embed('assets/more.png')"/>
<s:Button width="50" height="50" label="4" click="button4_clickHandler(event)"
icon="@Embed('assets/more.png')" skinClass="spark.skins.spark.ButtonSkin"/>
</s:HGroup>
</s:Panel>
</s:VGroup>
</csxs:CSExtension>
设计是这样的:
第四步:右击项目点击“运行方式” 勾选平台Ilustrator CS6 确认。
结果运行时这样的(⊙o⊙)… 可能一AI深灰色渲染有关。