複習 DBA Skills/Oracle -- 進深 3
A. 在我整理的Nodepad Plus Plus Projects for JDFD的PGA : processes(in memory)中的第A-1/A-1-1項:Active Session History(ASH),是身為DBA常用的。
1. Active Session History(ASH) 預設查詢結果:
(1). Top Events
(2). Load Profile
(3). Top SQL
(4). Top PL/SQL
(5). Top Java
(6). Top Call Types
(7). Top Sessions
(8). Top Objects/Files/Latches
(9). Activity Over Time
A. 在我整理的Nodepad Plus Plus Projects for JDFD的PGA : processes(in memory)中的第A-1/A-1-1項:Active Session History(ASH),是身為DBA常用的。
1. Active Session History(ASH) 預設查詢結果:
(1). Top Events
複習 DBA Skills/Oracle -- 進深 2
A. 在我整理的Nodepad Plus Plus Projects for JDFD的DBA ITEMS中的第33項:33_alltablespaces(存儲/表空間/[XXX]/資料檔案Data Files) -- of system_and_else
1. USERS 預設特性:
(1). 預設大小:自動擴充
(2). 是否記入日誌:YES
(3). 是否常駐:YES
(4). 是否ONLINE:NO
2. USERS 使用情況:
SELECT * FROM dba_segments WHERE TABLESPACE_NAME='USERS' ORDER BY bytes DESC
GO
A. 在我整理的Nodepad Plus Plus Projects for JDFD的DBA ITEMS中的第33項:33_alltablespaces(存儲/表空間/[XXX]/資料檔案Data Files) -- of system_and_else
1. USERS 預設特性:
(1). 預設大小:自動擴充
(2). 是否記入日誌:YES
(3). 是否常駐:YES
(4). 是否ONLINE:NO
2. USERS 使用情況:
SELECT * FROM dba_segments WHERE TABLESPACE_NAME='USERS' ORDER BY bytes DESC
GO
3. USERS 仍需要修改的情況:
(1). 當把其他objects占用其他的table_space的情況中的某項占用的object移轉至USERS時:
destinationTablespace
- 表格空間 USERS 沒有足夠的可用空間供 [XXX] 使用. 表格空間 USERS 有 0.88MB 的可用空間, 但 [XXX] 需要 71.62MB
(1). 當把其他objects占用其他的table_space的情況中的某項占用的object移轉至USERS時:
destinationTablespace
- 表格空間 USERS 沒有足夠的可用空間供 [XXX] 使用. 表格空間 USERS 有 0.88MB 的可用空間, 但 [XXX] 需要 71.62MB
複習 DBA Skills/Oracle -- 進深 1
A. 在我整理的Nodepad Plus Plus Projects for JDFD的DBA ITEMS中的第31項:31_allbackups(備份)
1. %ORACLE_HOME%\product\11.2.0\dbhome_1\assistants\dbca\templates (Ref : Oracle -- Database Configuration Assistant (DBCA) templates)中有兩個 file:
(1). Oracle Database's Control File:Seed_Database.ctl
(2). Oracle Database's Data File:Seed_Database.dfb
它們被回復成:
a. SYSTEM01.DBF
b. SYSAUX01.DBF
1. 執行 %ORACLE_HOME%\product\11.2.0\dbhome_1\assistants\dbca\templates (Ref : Oracle -- Database Configuration Assistant (DBCA) templates) 回復的 SQL Script:
A. 在我整理的Nodepad Plus Plus Projects for JDFD的DBA ITEMS中的第31項:31_allbackups(備份)
1. %ORACLE_HOME%\product\11.2.0\dbhome_1\assistants\dbca\templates (Ref : Oracle -- Database Configuration Assistant (DBCA) templates)中有兩個 file:
(1). Oracle Database's Control File:Seed_Database.ctl
(2). Oracle Database's Data File:Seed_Database.dfb
它們被回復成:
a. SYSTEM01.DBF
b. SYSAUX01.DBF
c. UNDOTBS01.DBF
1. 執行 %ORACLE_HOME%\product\11.2.0\dbhome_1\assistants\dbca\templates (Ref : Oracle -- Database Configuration Assistant (DBCA) templates) 回復的 SQL Script:
set verify off;
set echo off;
set serveroutput on;
select TO_CHAR(systimestamp,'YYYYMMDD HH:MI:SS') from dual;
variable devicename varchar2(255);
declare
omfname varchar2(512) := NULL;
done boolean;
begin
dbms_output.put_line(' ');
dbms_output.put_line(' Allocating device.... ');
dbms_output.put_line(' Specifying datafiles... ');
:devicename := dbms_backup_restore.deviceAllocate;
dbms_output.put_line(' Specifing datafiles... ');
dbms_backup_restore.restoreSetDataFile;
dbms_backup_restore.restoreDataFileTo(1, '%ORACLE_HOME%\oradata\orcl4\SYSTEM01.DBF', 0, 'SYSTEM');
dbms_backup_restore.restoreDataFileTo(2, '%ORACLE_HOME%\oradata\orcl4\SYSAUX01.DBF', 0, 'SYSAUX');
dbms_backup_restore.restoreDataFileTo(3, '%ORACLE_HOME%\oradata\orcl4\UNDOTBS01.DBF', 0, 'UNDOTBS1');
dbms_backup_restore.restoreDataFileTo(4, '%ORACLE_HOME%\oradata\orcl4\USERS01.DBF', 0, 'USERS');
dbms_output.put_line(' Restoring ... ');
dbms_backup_restore.restoreBackupPiece('%ORACLE_HOME%\product\11.2.0\dbhome_1/assistants/dbca/templates\Seed_Database.dfb', done);
if done then
dbms_output.put_line(' Restore done.');
else
dbms_output.put_line(' ORA-XXXX: Restore failed ');
end if;
dbms_backup_restore.deviceDeallocate;
end;
/
select TO_CHAR(systimestamp,'YYYYMMDD HH:MI:SS') from dual;
開發 Angular.io's WebPack Project 情境 10 -- 回歸基礎 2
我在我的電腦開發環境,設置了Prod、Dev的兩個不同的環境。Node JS、NPM、Angular CLI 使用不同的版本。Dev的環境可以盡情地利用、測試、變更Node JS、NPM、Angular CLI 的版本,即使,開發的環境弄壞掉也沒有關係。Maven我並沒切換。
Prod:Node JS 使用 v8.11.3、NPM 使用 5.6.0;Dev:Node JS 使用 v10.8.0(最新的、現行的版本)、NPM 使用 6.2.0。
環境備齊後,接下來,一個重要的步驟,就是,在Prod環境安裝、驗測之前提到過的Angular Open Project 1。
我在我的電腦開發環境,設置了Prod、Dev的兩個不同的環境。Node JS、NPM、Angular CLI 使用不同的版本。Dev的環境可以盡情地利用、測試、變更Node JS、NPM、Angular CLI 的版本,即使,開發的環境弄壞掉也沒有關係。Maven我並沒切換。
Prod:Node JS 使用 v8.11.3、NPM 使用 5.6.0;Dev:Node JS 使用 v10.8.0(最新的、現行的版本)、NPM 使用 6.2.0。
環境備齊後,接下來,一個重要的步驟,就是,在Prod環境安裝、驗測之前提到過的Angular Open Project 1。
開發 Angular.io's WebPack Project 情境 9 -- 回歸基礎 1
1. Node JS,使用Active LTS()真的很重要 -- About:Node.js(Server Side JS) and NPM CLI version
15-1_Active LTS Version:8.x
15-1-1_Status:Active LTS
15-1-2_Codename:Carbon
15-1-3_Initial Release:2017-05-30
15-1-4_Active LTS Start:2017-10-31
15-1-5_Maintenance LTS Start:April 2019
15-1-6_End-of-life:December 20191
(15-1 的數字是我的NotePad++ Project內Node.js(Server Side JS) and NPM CLI version內Element的數字。之後我都以此為記述、回查標準。)
2. Active LTS Version,版本固定,不會隨便被其他的開發者更新了Node、NPM、CLI的版本,導致於各專案內的Node、NPM、CLI的版本錯亂。程式無法編譯、無法執行。定版的工作對我而言很重要。
(1). 目前,我的電腦的Node/NPM的環境版本為:5.6.0 。而在此期間Node/NPM的版本,已經從:5.6.0→ 變為:6.1.0→ 變為:6.3.0。(你總會看到:Update available 5.6.0 → 6.3.0,Run npm i npm to updatek的訊息。)。我的規劃:我不會更新。雖然,Global的環境,Angular CLI的版本已經被我升級到: 6.1.1、@angular-devkit的版本已經被我升級到: 0.7.1。
(2). 我的其中的一個範例專案的環境,Angular CLI的版本仍是: 6.0.8、@angular-devkit的版本仍是: 0.6.8。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.4.1
@angular/cli 6.0.8
@angular/material 6.4.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.2
typescript 2.7.2
webpack 4.8.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Node JS,使用Active LTS()真的很重要 -- About:Node.js(Server Side JS) and NPM CLI version
15-1_Active LTS Version:8.x
15-1-1_Status:Active LTS
15-1-2_Codename:Carbon
15-1-3_Initial Release:2017-05-30
15-1-4_Active LTS Start:2017-10-31
15-1-5_Maintenance LTS Start:April 2019
15-1-6_End-of-life:December 20191
(15-1 的數字是我的NotePad++ Project內Node.js(Server Side JS) and NPM CLI version內Element的數字。之後我都以此為記述、回查標準。)

2. Active LTS Version,版本固定,不會隨便被其他的開發者更新了Node、NPM、CLI的版本,導致於各專案內的Node、NPM、CLI的版本錯亂。程式無法編譯、無法執行。定版的工作對我而言很重要。
(1). 目前,我的電腦的Node/NPM的環境版本為:5.6.0 。而在此期間Node/NPM的版本,已經從:5.6.0→ 變為:6.1.0→ 變為:6.3.0。(你總會看到:Update available 5.6.0 → 6.3.0,Run npm i npm to updatek的訊息。)。我的規劃:我不會更新。雖然,Global的環境,Angular CLI的版本已經被我升級到: 6.1.1、@angular-devkit的版本已經被我升級到: 0.7.1。
(2). 我的其中的一個範例專案的環境,Angular CLI的版本仍是: 6.0.8、@angular-devkit的版本仍是: 0.6.8。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.4.1
@angular/cli 6.0.8
@angular/material 6.4.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.2
typescript 2.7.2
webpack 4.8.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
開發 Angular.io's WebPack Project 情境 8 -- 第一次感受到Node的威力 !!
雖然,文章的Title是"開發 Angular.io's WebPack Project 情境 8 -- ...",但,內文跟Angular.io's WebPack Project沒有關係,是關於Node。
昨天提到得獎的Open Project 1。這個範例是使用Node JS,透過執行Pure JavaScript的方式,在Open Project 1的Platform內建立客製化(Customized)的群組(Groups)、和使用者(Users)。
在Local的環境,你首先要安裝NPM、Node.js(網路上最新的版本,直接安裝,不需要特別的設定),啟動Open Project 1's Server,安裝 Open Project 1的JavaScript Library 於 NPM 內,然後,按著Open Project 1的API範例,建立 一個範例的 JavaScript的File,然後,透過Node,很單純地 執行 這個JavaScript的File,就可以將這個 JavaScript的File內的客製化(Customized)的群組(Groups)、和使用者(Users)建立入Open Project 1的Platform內。
雖然,文章的Title是"開發 Angular.io's WebPack Project 情境 8 -- ...",但,內文跟Angular.io's WebPack Project沒有關係,是關於Node。
昨天提到得獎的Open Project 1。這個範例是使用Node JS,透過執行Pure JavaScript的方式,在Open Project 1的Platform內建立客製化(Customized)的群組(Groups)、和使用者(Users)。
在Local的環境,你首先要安裝NPM、Node.js(網路上最新的版本,直接安裝,不需要特別的設定),啟動Open Project 1's Server,安裝 Open Project 1的JavaScript Library 於 NPM 內,然後,按著Open Project 1的API範例,建立 一個範例的 JavaScript的File,然後,透過Node,很單純地 執行 這個JavaScript的File,就可以將這個 JavaScript的File內的客製化(Customized)的群組(Groups)、和使用者(Users)建立入Open Project 1的Platform內。
(圖1)
(圖2)
(圖3)
(圖4)
(圖5)
(圖6)
(圖7)
(圖8)
(圖9)
(圖10)
使用 Open Source Project 1 情境 1 -- Open Source Project 1 -- Administrator
Open Source Project 1 is a kind of Document Management Software.
我還滿喜歡這個Open Source Project 1*(A Document Management Software)的,我想好好的學習,並且能運用。為什麼是它 ? 因為,最近都在學Flex(Angular的前身),找著找著就找到了它。它的Client's Maven Project的問題,非常難處理,我從未遇過,我花了快三天。昨天全部解決完畢。我用 Maven:mvn install、Ant:ant deploy,都順利完成。它的Client's Maven Project有幾個是跟Adobe Flex有關。如果,要進階學習Adobe Flex,這是一個相當好的範例:e.g:竟然可以用Maven將*.as,編譯成*.swf。超級強大的。它還有自己的 Shell Script。雖然是Open Source Project,但我不知道我的License能用多久。將來學習完成後,可以用在Business上。它前幾年拿過Best Java Open Source的大獎。突然,回想起,之前用過的Grails也得過Best Java 的大獎。
不過,這個Open Source Project 1的Server's Maven Project,好像跟Adobe Flex沒有關係,我查看了一下,它用來畫圖的Framework,好像是:chat.js。
1. Admin's Analytics:
2. The Tables:MySQL
Open Source Project 1 is a kind of Document Management Software.
我還滿喜歡這個Open Source Project 1*(A Document Management Software)的,我想好好的學習,並且能運用。為什麼是它 ? 因為,最近都在學Flex(Angular的前身),找著找著就找到了它。它的Client's Maven Project的問題,非常難處理,我從未遇過,我花了快三天。昨天全部解決完畢。我用 Maven:mvn install、Ant:ant deploy,都順利完成。它的Client's Maven Project有幾個是跟Adobe Flex有關。如果,要進階學習Adobe Flex,這是一個相當好的範例:e.g:竟然可以用Maven將*.as,編譯成*.swf。超級強大的。它還有自己的 Shell Script。雖然是Open Source Project,但我不知道我的License能用多久。將來學習完成後,可以用在Business上。它前幾年拿過Best Java Open Source的大獎。突然,回想起,之前用過的Grails也得過Best Java 的大獎。
不過,這個Open Source Project 1的Server's Maven Project,好像跟Adobe Flex沒有關係,我查看了一下,它用來畫圖的Framework,好像是:chat.js。
1. Admin's Analytics:
2. The Tables:MySQL
Maven 情境 13 -- About:maven-resources-plugin:2.5 or one of its dependencies could not be resolved
晚上7:47
Maven 情境 13 -- About:maven-resources-plugin:2.5 or one of its dependencies could not be resolved
前幾天,我最新的一個專案的 Leader,幫我看我的新專案環境在使用時,IDE的Maven Plugin的問題,是關於:maven-resources-plugin:2.5 or one of its dependencies could not be resolved。
他一直無法解決,最後只能說是我環境的問題。
所以,我就專心來看看。
於是,我在CMD,打開Maven的Debug模式,來細看問題:
結果,有兩個狀況要 Troubleshooting:
1. Jar file 無法正確 Download:
Downloading: http://XX.XX.XX.XX:8080/artifactory/repo/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
[DEBUG] Writing tracking file C:\~\.m2\repository\org\codehaus\plexus\plexus-utils\3.0.5\plexus-utils-3.0.5.jar.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.545s
[INFO] Finished at: Thu Jul 19 16:45:46 CST 2018
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
解決方式:
(1). 刪除:plexus-utils-3.0.5.jar.lastUpdated
(2). 重新執行:mvn install
2. 在 settings.xml,新增:
<mirror>
<id>Central</id>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
後來都解決了。問題不再發生了。
前幾天,我最新的一個專案的 Leader,幫我看我的新專案環境在使用時,IDE的Maven Plugin的問題,是關於:maven-resources-plugin:2.5 or one of its dependencies could not be resolved。
他一直無法解決,最後只能說是我環境的問題。
所以,我就專心來看看。
於是,我在CMD,打開Maven的Debug模式,來細看問題:
結果,有兩個狀況要 Troubleshooting:
1. Jar file 無法正確 Download:
Downloading: http://XX.XX.XX.XX:8080/artifactory/repo/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
[DEBUG] Writing tracking file C:\~\.m2\repository\org\codehaus\plexus\plexus-utils\3.0.5\plexus-utils-3.0.5.jar.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.545s
[INFO] Finished at: Thu Jul 19 16:45:46 CST 2018
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
解決方式:
(1). 刪除:plexus-utils-3.0.5.jar.lastUpdated
(2). 重新執行:mvn install
2. 在 settings.xml,新增:
<mirror>
<id>Central</id>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
後來都解決了。問題不再發生了。
開發 Flex 情境 22 -- 關於 : Flex 比較 3 -- Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 成功 !!

Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 成功 !! (Use:Flex SDK 4.6) -- Part II
1. Flex Project:
(1). Flex SDK 3.2:
a. 舊版的 html-template,和新版的 html-template 內的 index.template.html、JS File(NEW:swfobject.js) 不一樣,所以Upgrade Project時,要用新版的 html-template。
b. 舊版的 html-template,使用AC_OETags.js,Gen 出 <object><embed>The Content</embed></object>:
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!-- END Browser History required section -->
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<!-- BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!-- END Browser History required section -->
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>
<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>
(2). Flex SDK 4.6:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title>${title}</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: ${bgcolor}; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section ${useBrowserHistory}>
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!${useBrowserHistory} END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "${expressInstallSwf}";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "${bgcolor}";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "${application}";
attributes.name = "${application}";
attributes.align = "middle";
swfobject.embedSWF(
"${swf}.swf", "flashContent",
"${width}", "${height}",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>
d. 新版的 Flash Builder,新增了Export the release build of the project的功能,同時,它會跟你說在Upgrade Project的工程中,在各個 Module內,原本用的舊版的SDK的寫法,有哪一些在新版的 SDK中已經不適用(不管是:刪除、不建議、衝突......),所以,可以開始進行程式Upgrdae層級的修改、Troubleshooting、re-factoring、或是改寫、重寫:
(a). Troubleshooting:
i. About:loadStyleDeclarations:

Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 成功 !! (Use:Flex SDK 4.6) -- Part II
1. Flex Project:
(1). Flex SDK 3.2:
a. 舊版的 html-template,和新版的 html-template 內的 index.template.html、JS File(NEW:swfobject.js) 不一樣,所以Upgrade Project時,要用新版的 html-template。
b. 舊版的 html-template,使用AC_OETags.js,Gen 出 <object><embed>The Content</embed></object>:
".......If you are using the wrapper that is generated by the web-tier compiler or Adobe® Flex® Builder™, or one of thec. 新版的 html-template,使用swfobject.js,Gen 出 <script>。
wrappers that are included in the /templates directory, your wrapper will probably be very different from the
previous example. These wrappers call functions in the AC_OETags.js file to build the <object> and <embed>
tag structure in the HTML page......"
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!-- END Browser History required section -->
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<!-- BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!-- END Browser History required section -->
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>
<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title>${title}</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: ${bgcolor}; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section ${useBrowserHistory}>
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!${useBrowserHistory} END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "${expressInstallSwf}";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "${bgcolor}";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "${application}";
attributes.name = "${application}";
attributes.align = "middle";
swfobject.embedSWF(
"${swf}.swf", "flashContent",
"${width}", "${height}",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>
(圖1)
(圖2) 刪除舊版SDK在bin-debug內的檔案
(圖3)
(圖4) 設定Locale,for Taiwan
(圖5) 用新版的 SDK,開始Build專案
(圖6) 用新版的 SDK,釋出(Release)專案
(圖7)
(圖8)
(圖9) Copy 至專案內。在專案內執行失敗,因為Framework框架是吃到舊版的SDK。
(圖10) 直接執行,成功。
d. 新版的 Flash Builder,新增了Export the release build of the project的功能,同時,它會跟你說在Upgrade Project的工程中,在各個 Module內,原本用的舊版的SDK的寫法,有哪一些在新版的 SDK中已經不適用(不管是:刪除、不建議、衝突......),所以,可以開始進行程式Upgrdae層級的修改、Troubleshooting、re-factoring、或是改寫、重寫:
(a). Troubleshooting:
i. About:loadStyleDeclarations:
See details for more information. Encountered errors or warnings while building project Main.mxml. MainScript.as: 'loadStyleDeclarations' has been deprecated since 4.0. Please use 'IStyleManager2.loadStyleDeclarations on a style manager instance'.
開發 Flex 情境 22 -- 關於 : Flex 比較 3 -- Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 成功 !!

今天順利地將新專案要用的相關的 Framework Projects、Utility Projects,
Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 (Still Use:Flex SDK 3.2)
1. Flex Project:
(1). Flex SDK 3.2:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
</mx:Application>
(2). Flex SDK 4.6:
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<fab:FlexApplication xmlns:fab="org.puremvc.as3.multicore.utilities.fabrication.components.*"
xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
xmlns:systex="http://www.systex.com.tw/mxml" initialize="loadStyle(event);">
<!-- Flex Script -->
<mx:Script source="MainScript.as"/>
<fab:FlexModuleLoader id="loader" width="100%" height="100%" />
</fab:FlexApplication>
2. Flex Library Project:
3. Flex Mobile Project:

今天順利地將新專案要用的相關的 Framework Projects、Utility Projects,
Upgrade 至 新的 Adobe® Flash® Builder™® 4.7 (Still Use:Flex SDK 3.2)
1. Flex Project:
(1). Flex SDK 3.2:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<fab:FlexApplication xmlns:fab="org.puremvc.as3.multicore.utilities.fabrication.components.*"
xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
xmlns:systex="http://www.systex.com.tw/mxml" initialize="loadStyle(event);">
<!-- Flex Script -->
<mx:Script source="MainScript.as"/>
<fab:FlexModuleLoader id="loader" width="100%" height="100%" />
</fab:FlexApplication>
2. Flex Library Project:
3. Flex Mobile Project:
4. ActionScript Project:
5. ActionScript Library Project:
6. ActionScript Mobile Project:
7. Flash Professional Project:
開發 Flex 情境 22 -- 關於 : Flex 比較 2
1. Main.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title></title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #ffffff; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
/**
1.
通過創建一個名為flashvars的對象添加Flash變量變量,在該對像上設置屬性,
然後將該對像傳遞給:swfobject.embedSWF()
2.
The value of the flashVars properties do not have to be static. If you use JSP to return the
wrapper, for example, you can use any JSP expression for the value of
the flashVars properties that can be evaluated to a String.
3.
Flash Builder 會自動更新Main.html的內容回原本預設的內容,所以,當build project
之後,加在flashvars、params內的新的內容,會被復舊。執行時,Main.mxml會無法取
用到新的parameter,會出現undefine的錯誤,或null的錯誤(當在Flash UI Component元件
內使用{}的時候) -- 註1。
*/
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "Main";
attributes.name = "Main";
attributes.align = "middle";
swfobject.embedSWF(
"Main.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
11.1.0 or greater is installed. -- XXX
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="Main">
<param name="movie" value="Main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="Main.swf" width="100%" height="100%">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
11.1.0 or greater is not installed. -- YYY
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>
2. index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>flex4-project-1</title>
<meta name="description" content="" />
<script src="js/swfobject.js"></script>
<script>
var flashvars = {
};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "",
wmode: "direct" // can cause issues with FP settings & webcam
};
var attributes = {
id:"flex4-project-1"
};
swfobject.embedSWF(
"flex4-project-1.swf",
"altContent", "100%", "100%", "10.0.0",
"expressInstall.swf",
flashvars, params, attributes);
</script>
<style>
html, body { height:100%; overflow:hidden; }
body { margin:0; }
</style>
</head>
<body>
<div id="altContent">
<h1>flex4-project-1</h1>
<p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>
</div>
</body>
</html>
註1:因此,Main.mxml的內容,以及Call Main.swf的方式如下
(1).
http://localhost:61221/flex-project-2/Main.swf?myName=yuehchung
(2).
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
applicationComplete="init()">
<fx:Style>
/*Button {
color:red;
}*/
</fx:Style>
<fx:Script>
<![CDATA[
// import mx.messaging.messages.AsyncMessage;
// import mx.messaging.messages.IMessage;
import mx.core.FlexGlobals;
/* Declare bindable properties in Application scope. */
[Bindable]
public var myName:String;
[Bindable]
public var myHometown:String;
private function init():void
{
myName = FlexGlobals.topLevelApplication.parameters.myName;
}
protected function button2_clickHandler(event:MouseEvent):void
{
log.text += "firstName:"+FlexGlobals.topLevelApplication.parameters.myName +"\n";
}
protected function button3_clickHandler(event:MouseEvent):void
{
for (var i:String in FlexGlobals.topLevelApplication.parameters) {
log.text += i + ":" + FlexGlobals.topLevelApplication.parameters[i] + "\n";
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<fx:Model id="MyEmployee">
<root>
<name>
<first>Will</first>
<last>Tuckerman</last>
</name>
<department>Accounting</department>
<email>wtuckerman@wilsoncompany.com</email>
</root>
</fx:Model>
</fx:Declarations>
<s:Panel title="Chat" top="12" bottom="12" left="12" right="12">
<s:TextArea id="log" width="100%" height="100%" borderVisible="false"/>
<s:controlBarContent>
<mx:Form width="100%" paddingTop="4" paddingBottom="4" paddingLeft="4" paddingRight="4">
<mx:FormItem label="User Id:{myName}">
<s:TextInput id="userId" width="100" enter=""/>
</mx:FormItem>
<mx:FormItem label="Message:" width="100%" direction="horizontal">
<s:TextInput id="msg" width="100%" enter=""/>
<s:Button label="Send 1" click="button2_clickHandler(event)"/>
<s:Button label="Send 2" click="button3_clickHandler(event)"/>
</mx:FormItem>
</mx:Form>
</s:controlBarContent>
</s:Panel>
</s:Application>
1. Main.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title></title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #ffffff; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
/**
1.
通過創建一個名為flashvars的對象添加Flash變量變量,在該對像上設置屬性,
然後將該對像傳遞給:swfobject.embedSWF()
2.
The value of the flashVars properties do not have to be static. If you use JSP to return the
wrapper, for example, you can use any JSP expression for the value of
the flashVars properties that can be evaluated to a String.
3.
Flash Builder 會自動更新Main.html的內容回原本預設的內容,所以,當build project
之後,加在flashvars、params內的新的內容,會被復舊。執行時,Main.mxml會無法取
用到新的parameter,會出現undefine的錯誤,或null的錯誤(當在Flash UI Component元件
內使用{}的時候) -- 註1。
*/
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "Main";
attributes.name = "Main";
attributes.align = "middle";
swfobject.embedSWF(
"Main.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
11.1.0 or greater is installed. -- XXX
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="Main">
<param name="movie" value="Main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="Main.swf" width="100%" height="100%">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
11.1.0 or greater is not installed. -- YYY
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>
2. index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>flex4-project-1</title>
<meta name="description" content="" />
<script src="js/swfobject.js"></script>
<script>
var flashvars = {
};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "",
wmode: "direct" // can cause issues with FP settings & webcam
};
var attributes = {
id:"flex4-project-1"
};
swfobject.embedSWF(
"flex4-project-1.swf",
"altContent", "100%", "100%", "10.0.0",
"expressInstall.swf",
flashvars, params, attributes);
</script>
<style>
html, body { height:100%; overflow:hidden; }
body { margin:0; }
</style>
</head>
<body>
<div id="altContent">
<h1>flex4-project-1</h1>
<p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>
</div>
</body>
</html>
註1:因此,Main.mxml的內容,以及Call Main.swf的方式如下
(1).
http://localhost:61221/flex-project-2/Main.swf?myName=yuehchung
(2).
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
applicationComplete="init()">
<fx:Style>
/*Button {
color:red;
}*/
</fx:Style>
<fx:Script>
<![CDATA[
// import mx.messaging.messages.AsyncMessage;
// import mx.messaging.messages.IMessage;
import mx.core.FlexGlobals;
/* Declare bindable properties in Application scope. */
[Bindable]
public var myName:String;
[Bindable]
public var myHometown:String;
private function init():void
{
myName = FlexGlobals.topLevelApplication.parameters.myName;
}
protected function button2_clickHandler(event:MouseEvent):void
{
log.text += "firstName:"+FlexGlobals.topLevelApplication.parameters.myName +"\n";
}
protected function button3_clickHandler(event:MouseEvent):void
{
for (var i:String in FlexGlobals.topLevelApplication.parameters) {
log.text += i + ":" + FlexGlobals.topLevelApplication.parameters[i] + "\n";
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<fx:Model id="MyEmployee">
<root>
<name>
<first>Will</first>
<last>Tuckerman</last>
</name>
<department>Accounting</department>
<email>wtuckerman@wilsoncompany.com</email>
</root>
</fx:Model>
</fx:Declarations>
<s:Panel title="Chat" top="12" bottom="12" left="12" right="12">
<s:TextArea id="log" width="100%" height="100%" borderVisible="false"/>
<s:controlBarContent>
<mx:Form width="100%" paddingTop="4" paddingBottom="4" paddingLeft="4" paddingRight="4">
<mx:FormItem label="User Id:{myName}">
<s:TextInput id="userId" width="100" enter=""/>
</mx:FormItem>
<mx:FormItem label="Message:" width="100%" direction="horizontal">
<s:TextInput id="msg" width="100%" enter=""/>
<s:Button label="Send 1" click="button2_clickHandler(event)"/>
<s:Button label="Send 2" click="button3_clickHandler(event)"/>
</mx:FormItem>
</mx:Form>
</s:controlBarContent>
</s:Panel>
</s:Application>










































