2011年6月21日 星期二

[AS3] ShareObject紀錄cookie

resource: http://www.republicofcode.com/tutorials/flash/as3sharedobject/

2011年6月20日 星期一

test_syntaxHighlighter

function helloSyntaxHighlighter()
{
 return "hi!";
}


http://alexgorbatchev.com/SyntaxHighlighter/download/

2011年6月17日 星期五

SwfObject- Part2(傳值給Swf)

Step1:swfObject的設定

  

主要在第四行的
var flashvars = {rs:"here is a text from html"};
rs為變數


Step2:as3語法
if (root.loaderInfo.parameters.rs == null){
 myText.text = "Loader is Null";
}
else{
 myText.text = root.loaderInfo.parameters.rs;
}

SwfObject- Part1(插入Swf)

以往插入swf物件都是使用Dreamweaver,它會產生一大堆語法,讓html變得複雜,可以使用SwfObject簡單的插入Swf物件。

Step1
裡面有範例可以直接使用

1. src資料夾:test.swf的原始檔

2. expressInstall.swf:當你電腦的Flash Player的版本比你使用的還要舊時,他會更新Flash Player

3. index.html:單純使用html使用此檔案

4. index_dynamic.html:若為動態網頁(如.asp或是.php)則使用index_dynamic.html
檔案內容(ps.之前寫asp就是因為使用index.html,所以一直出現巢狀object錯誤)

5. swfobject.js:需要此檔案才能將swf載入html

6. test.swf:你的swf檔
































Step2
在<head>跟</head>之間,將swfobject.js載入html
<script type="text/javascript" src="swfobject.js"></script>

swfobject.embedSWF("test.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf");

在<body>與</body間
<div id="myContent">

<h1>Alternative content</h1>
<p><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></p></div>
語法說明:
1. test.swfswf檔
2. myContent須與div id同名
3. "300"、"120"swf的高與寬,若要全螢幕可使用100%
4."9.0.0"Flash Player版本
5. expressInstall.swf:更新flash player


Step3 
可設定swf的參數,如透明度使用
var flashvars = {};                   //傳值給swf用
var params = {wmode:"transparent"};   //如需不需要選單;menu="false"
var attributes = {};
swfobject.embedSWF("test.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);