打工記事 part II
特記
我不是王子但是我吃了王子的禮物
結論:當王子不錯
要拿要腦殘大賽的冠軍,跟年齡成反比
結論:丁丁無敵
微風廣場的1F跟P1中有個G
結論:這不重要
amxmlc ApolloHelloWorld.mxml會有上面的錯誤。
Exception in thread "main" java.lang.NoClassDefFoundError: flash/localization/ILocalizer
;C:\Apollo\bin\加上上面這行。(請與解壓縮的路徑相同)
C:\Apollo\lib\adt.jar這樣就設定完路徑了。
package {
import flash.display.*;
import flash.text.*;
public class first extends Sprite{
public function first(){
var tf1:TextField = new TextField();
tf1.text = "第一次的Apollo程式設計";
tf1.width = 300; //表示文字横幅
tf1.height = 200; //表示文字縦幅
tf1.x = 50; //表示文字横位置
tf1.y = 20; //表示文字縦位置
addChild(tf1); //追加
//視窗表示
stage.window.visible=true;
}
}
}以上的原始碼、命名first.as用TF-8保存、之後編譯。成功編譯之後、會作成first.swf檔案。cd /d 下載、解壓縮的資料夾
amxmlc -default-size 400 400 -default-frame-rate=30 -default-background-color=0xCCCCCC first.as
之後、最後在CMD中執行adt指令、讀入SWF檔案與ADF(XML的設定檔案、之後製作成AIR檔案。<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/apollo/application/1.0.M3"
appId="zapanet.info.first" version="1.0">
<properties>
<name>first</name>
<publisher>first</publisher>
<description>first apollo</description>
<copyright>(C) ZAPAnet</copyright>
</properties>
<rootContent
systemChrome="standard"
transparent ="false"
visible ="false">first.swf</rootContent>
<icon>
<image16x16>icons/ApolloApp_16.png</image16x16>
<image32x32>icons/ApolloApp_32.png</image32x32>
<image48x48>icons/ApolloApp_48.png</image48x48>
<image128x128>icons/ApolloApp_128.png</image128x128>
</icon>
</application>
如果沒有錯誤的話、first.air就是個Apollo程式。adt -package first.air first.xml first.swf icons
以上的原始碼、用ApolloHelloWorld.mxml保存、編譯它。<?xml version="1.0" encoding="utf-8"?>
<mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="Hello World">
<mx:Style>
Application
{
background-image:"";
background-color:"";
background-alpha:"0.5";
}
</mx:Style>
<mx:Label text="Hello Apollo" horizontalCenter="0" verticalCenter="0"/>
</mx:ApolloApplication>
成功編譯後、可以產生ApolloHelloWorld.swf。amxmlc ApolloHelloWorld.mxml
在說明文件中的範例是、寫成visible="false"、這樣是沒有顯示的執行、這裡改成true。<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/apollo/application/1.0.M3"
appId="ApolloHelloWorld" version="1.0">
<properties>
<name>Hello World</name>
<description>A test Apollo application.</description>
<publisher>Apollo Test</publisher>
<copyright>2007</copyright>
</properties>
<rootContent systemChrome="none" transparent="true"
visible="true">ApolloHelloWorld.swf</rootContent>
<icon>
<image16x16>icons/ApolloApp_16.png</image16x16>
<image32x32>icons/ApolloApp_32.png</image32x32>
<image48x48>icons/ApolloApp_48.png</image48x48>
<image128x128>icons/ApolloApp_128.png</image128x128>
</icon>
</application>
如果沒有錯誤、ApolloHelloWorld.air就是Apollo程式。adt -packageApolloHelloWorld.air ApolloHelloWorld.xml ApolloHelloWorld.swf icons



