Flex比較有趣的地方就是顯示組件的.mxml與.as之間觀念轉換,假設我們要繼承一個Button,新的類別名稱為mybutton,置放於package com中,那麼.as檔架構的Class程式碼會如下
package com
{
import spark.components.Button;
public class myButton extends Button
{
public function myButton()
{
super();
}
//Override inherited method and properties.
//Define new method and properties.
//Custom logic in ActionScript.
}
}
2010年8月19日 星期四
The Flex class hierarchy
Using Flex 章節About custom components
The Flex class hierarchy
All visual components are derived from the UIComponent ActionScript class. Flex nonvisual components are also implemented as a class hierarchy in ActionScript. The most commonly used nonvisual classes are the Validator, Formatter, and Effect base classes.
這段文章指出了Flex所有的視覺組件都是以UIComponent為父類,也是Flex開發中所有直接放於畫面上的顯示元件都必須繼承了UIComponent,那麼Flash所使用的顯示元件要如何放於畫面上,就是透由UIComponent來做,將Flash的顯示元件加入UIComponent即可。
如:
The Flex class hierarchy
All visual components are derived from the UIComponent ActionScript class. Flex nonvisual components are also implemented as a class hierarchy in ActionScript. The most commonly used nonvisual classes are the Validator, Formatter, and Effect base classes.
這段文章指出了Flex所有的視覺組件都是以UIComponent為父類,也是Flex開發中所有直接放於畫面上的顯示元件都必須繼承了UIComponent,那麼Flash所使用的顯示元件要如何放於畫面上,就是透由UIComponent來做,將Flash的顯示元件加入UIComponent即可。
如:
Flex set JVM help size
§Flex設定JVM 堆積區大小
在Using Flex4說明文件中提到
The compilers use the Java JRE. As a result, you can also configure settings such as memory allocation and source path with the JVM arguments.
Flex的編譯器需使用JVM來運作,因此,你也可以以設定記憶體配置與源路徑參數用於JVM上。
該設定檔名為jvm.config,該檔位於SDK中的bin底下,如win7會像是
C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1\bin\jvm.config
在Using Flex4說明文件中提到
The compilers use the Java JRE. As a result, you can also configure settings such as memory allocation and source path with the JVM arguments.
Flex的編譯器需使用JVM來運作,因此,你也可以以設定記憶體配置與源路徑參數用於JVM上。
該設定檔名為jvm.config,該檔位於SDK中的bin底下,如win7會像是
C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1\bin\jvm.config
2010年8月18日 星期三
保護FMS上的影片內容,Protect video content (Flash Media Server)
基本的兩個方法:
Verify SWF files 設定(以windows為例)
- Verify SWF files
- RTMPE
Verify SWF files 設定(以windows為例)
- 於FMS底下找到[FMS資料夾]\conf\_defaultRoot_\Application.xml
- 找到標籤<SWFVerification enabled="false">將其改成<SWFVerification enabled="true"> ,這是啟動SWF驗證功能。
- 找到標籤<SWFFolder></SWFFolder>將其改成<SWFFolder>C:\Program Files\Adobe\SWFs</SWFFolder>,裡面的路徑放你自己容易管理的所在位置即可,官方文件上建議使用SWFs作為驗證資料夾名稱,這個資料夾是用來置放驗證的SWF,也就是當你建立一隻SWF檔之後,該SWF檔須複製一份於此資料夾,否則FMS部會允許該SWF檔連線,也就是不再驗證資料夾內的SWF檔都無法使用FMS資源。
- RTMPE在FMS中是預設啟用的。
- 找到標籤<DisallowedProtocols> </DisallowedProtocols>將其設成<DisallowedProtocols>rtmp,rtmps,rtmpt</DisallowedProtocols>,這行是說禁止使用rtmp、rtmps、rtmpt,也就是說只能使用rtmpe協定連線。
深入淺出JAVA,第一章,閱讀筆記
JAVA運作方式
Class與main
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
迴圈結構 while 、do-while 、for
int x = 2;
while(x){}
int x = 3;
if(x == 3){
System.out.println("x =3");
}
int value = 3;
if(value ==2){
//條件測試結果為true時執行
System.out.println("數值是2");
}else{
//條件測試結果為false時執行
System.out.println("數值不是2");
}
- 編寫原始碼文件,原始碼文件以.java為附檔名。
- 編譯器編譯原始碼文件。
- 產出Bytecode檔案,經編譯產出的bytecode檔,以.class為附檔名。
- Virtual Machine讀取執行Bytecode檔。
Class與main
- 每個Java程式中只能有一個main() Mathod,且每個程式至少都會有一個main與class。
- 所有Java程式都是由main()開始執行。
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
迴圈結構 while 、do-while 、for
- 迴圈關鍵在於測試條件(conditional test),測試結果必定是boolean值,ture或false。
- java的測試條件只接受boolean,若給予非boolean的值會編譯錯誤!與AS3很不同。
int x = 2;
while(x){}
- 上述程式片段中,於JAVA中此x是整數,編譯時會發生錯誤,而在AS3中則會以非0值皆為true來運行,因為AS3具有隱含轉換。
int x = 3;
if(x == 3){
System.out.println("x =3");
}
int value = 3;
if(value ==2){
//條件測試結果為true時執行
System.out.println("數值是2");
}else{
//條件測試結果為false時執行
System.out.println("數值不是2");
}
Flex3 Embed Font
Flex3中需Embed 字形才能讓文字做旋轉等效果,Flex4中似乎是不需要Embed就可以做出文字旋轉放大的效果,日後查明,先行紀錄Flex3 Embed Font用法。
Flex3中Embed Font
@font-face
{
src:url("/fonts/MSJH.ttf");
fontFamily:DIN;
advancedAntiAliasing: true;
}
.embeddedFontStyle
{
fontFamily:DIN;
fontSize:18px;
color:#CCCCFF;
}
Flex3中Embed Font
@font-face
{
src:url("/fonts/MSJH.ttf");
fontFamily:DIN;
advancedAntiAliasing: true;
}
.embeddedFontStyle
{
fontFamily:DIN;
fontSize:18px;
color:#CCCCFF;
}
2010年7月2日 星期五
SWF內使用play()當function名稱,在IE8中會出現錯誤
SWF內若有使用到play( ),在IE8中會出現錯誤,因此在flash/flex開發中要注意,不要使用play()當做操作名稱。
訂閱:
文章 (Atom)