crossdomain.xml 沒有被自動載入

ActionScript3.0 2010/02/01 08:50
在LOAD的時候加一下new LoaderContext(true),因為預設值是FALSE,妳要設成TRUE crossdomain.xml 才會被載入

var myLoader=new Loader();
 var requestor : URLRequest = new URLRequest(picPath);
 myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaderCompleteHandler);
 myLoader.load(requestor,new LoaderContext(true))
top

Trackback Address :: http://diary.tw/allenliao/trackback/860

Write a comment


介紹一款很好用的軟體swfEncrypt

Flash常見問題&教材 2008/06/19 09:57
妳寫在FLASH的AS CODE見不得人嗎?swfEncrypt是ㄧ套你可以參考使用看看的好軟體
swfEncrypt可以幫你避開大多數的反組譯軟體的返組譯行為,
而你所需要做的,只是幾個步驟的設定,就可以幫你的SWF加密
是的,大部份的反組譯軟體而已(有些反組譯軟體聲稱已破解swfEncrypt的加密方式),不過也夠讓有心想覷竊程式的人頭痛了

其實像CODE的保護或加密,只是防君子不防小人的,在困難的加密防範,遲早都要被破的...囧

(swfEncrypt 的官網上下載試用版5.0 RUN不起來...搞屁阿~ㄧ定要逼我花錢就是了啊!我的測試是跟在我朋友的電腦用的~真的沒辦法返組譯ㄟ~)
top

Trackback Address :: http://diary.tw/allenliao/trackback/522

Write a comment


crossdomain.xml server timeout 或沒被allow的EVEN處理

Flash常見問題&教材 2008/06/10 10:46
在flash 妳要跨網域做loadVars flash Player ㄧ定會去問crossdomain.xml若問不過  AS2 沒有任何EVENT會觸發跟你說現在是什麼情形...Orz

但AS3雖然有onSecurityError但該DOMAIN只要第一次被觸發這個EVENT之後,flash Player就不會去問這個DOMAIN了,會在client端(flash Player)就擋掉所有DOMAIN的request,包含security.loadPolicyFile也是,所以你若是crossdomain.xml server timeout 你真的只能重LOAD頁面,不過若SERVER可以搭配reWrite讓flash Player以為你是訪問不同的DOMAIN那就有解了

作法:
AS:

var URLarr:Array=new Array("otherdomainA.im.tv", "otherdomainB.im.tv", "otherdomainC.im.tv");
var idx=0;

function loadXML(){
   var srt = URLarr[idx]+"/aa.txt";
   var my_lv:LoadVars = new LoadVars();
   my_lv.onLoad = function(success:Boolean) {
      if (success) {
        myHtml.text = this.toString();
        clearInterval(IntNum);
      } else {
        trace("Error loading/parsing LoadVars.");
      }
   };
  my_lv.load(srt);//這一行會觸發檢查http://otherdomain.im.tv/crossdomain.xml
  idx++
}
var IntNum = setInterval(loadXML, 1000);

server的rewrite
設成若request為
otherdomainA.im.tv, otherdomainB.im.tv, otherdomainC.im.tv 都轉導為otherdomain.im.tv(flash吃轉導(304)的content)

top

Trackback Address :: http://diary.tw/allenliao/trackback/516

Write a comment


player 9.0.115.0 新增一個新的安全性機制

心得筆記 2008/05/16 02:11
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403030&sliceId=1

>很多HTTP HEADER都被擋住了

http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403185&sliceId=2
>player 9.0.115.0之後的版本在做帶HEADER的REQUEST的時候都會去檢查這一條

所以放在server的crossdomain.xml要多加這個TAG
 <allow-http-request-headers-from domain="*.example.com" headers="*" secure="true"/>

妳應該會遇到的錯誤代碼:
error#2170
top

Trackback Address :: http://diary.tw/allenliao/trackback/499

Write a comment


flvPlayBack組件安全性問題

Flash常見問題&教材 2008/04/26 10:24
Art喜歡用flvPlayBack組件來播放影片,因為只要簡單的設定連control Bar都有得選,
這個問題是發現在類似下面部署的情況下才會發生:

IamPlayer.swf放在abc.com的主機上
嵌入IamPlayer.swf的頁面IamPage.html放在efg.com的主機上
IamPlayer.swf上有一個flvPlatBack組件設定如下圖
用戶插入圖片

http://efg.com/IamPage.html執行時一開始你會發現這支影片沒有控制Bar
用Fiddler觀察,我們發現原來flvPlayBack組件預設是去頁面的相對路徑找控制Bar.swf(看你選的是哪一種控制Bar,FLASH在編譯時會拷貝一份控制Bar.swf在你編譯好的SWF旁)
於是我們在http://efg.com/補上控制Bar的swf,再執行一次http://efg.com/IamPage.html你應該會發現另ㄧ個問題,影片沒有自動播放,這就是我說的安全性的問題,因為我們跨網域去存取別的網域上的SWF了,解決方式是,讓她們同網域就行了

先給flvPlayBack組件ㄧ個實體名稱myPlayBack
在該flvPlayBack組件的影格上下
STOP():
myPlayBack.skin="http://abc.com/控制Bar.swf";

當然
abc.com 的主機上要記得拷貝一份控制Bar.swf在上面
問題就解決了~
top

Trackback Address :: http://diary.tw/allenliao/trackback/495

Write a comment


AS3 安全性測試-雜記

ActionScript3.0 2007/10/02 07:40
測式範例說明:
從A.com載Q.JPG及Q.SWF回B.COM
下載完成後
你企圖用Event.target.content.width去改變大小,Q.SWF會有安全性限制的警告
Q.JPG任人宰割(前提是A.com/crossdomain.xml要allow B.COM)

結論:
LOAD SWF 和 JPG(不做編輯存取)是沒有限制的,怎麼LOAD都可以!

a.LOAD圖片後編輯只要圖片的機器crossdomain.xml有allow 就OK
b.LOAD SWF後編輯SWF的機器有沒有crossdomain.xml都沒差,但被編輯的SWF需要下System.Security.allowDomain("*")
c.LOAD XML或存取像ASP這種SERVER SCRIPT 需要文件上的機器crossdomain.xml有allow 方可存取
d.不同DOMAIN的SWF要使用 LocalConnection,偵聽的SWF需要使用 LocalConnection.allowDomain() 方法,授予 傳送的SWF 傳送的權限,

觀念:
來自網際網路的資源 (包括 SWF 檔) 分類置入不同的安全執行程序中,這些程序會分別對應於這些資源之來源網站的原始網域>>也就是說一個網域一個安全執行程序(
sandbox)


參考:

  • You can load content from any accessible source. (除了文件隨你怎麼LOAD都可以)
  • Loading is not allowed if the calling SWF file is in a network sandbox and the file to be loaded is local.(網路上的SWF不可以LOAD LOCAL端的檔案)
  • If the loaded content is a SWF file, it cannot be scripted by a SWF file in another security sandbox unless that cross-scripting arrangement was approved through a call to the Security.allowDomain() method in the loaded content file. .(LOAD 外部DOMAIN的SWF檔案時,被LOAD的SWF檔不能被LOAD他的SWF控制(改大小、呼叫變數函數等等),除非被LOAD的SWF有呼叫Security.allowDomain() 這行指令來允許cross-scripting)
  • SWF files written in ActionScript 1.0 or 2.0, which are loaded as AVM1Movie objects, cannot cross-script SWF files written in ActionScript 3.0, which are loaded as Sprite or MovieClip objects. You can use the LocalConnection class to have these files communicate with each other. (若被LOAD的SWF是用AS2或AS1寫的,則無法cross-scripting,若要溝通需靠LocalConnection 才能完成)
  • If the loaded content is an image, its data cannot be accessed by a SWF file outside of the security sandbox, unless the domain of that SWF file was included a cross-domain policy file at the origin domain of the image. (若LOAD 外部DOMAIN的圖片檔案,而想存取該圖片的資訊(EX:做遮罩)除非該圖的機器的crossdomain.xml allow LOAD檔的SWF的DOMAIN)
  • Movie clips in the local-with-file-system sandbox cannot cross-script movie clips in the local-with-networking sandbox, and the reverse is also prevented.
  • You can prevent a SWF file from using this method by setting the allowNetworking parameter of the the object and embed tags in the HTML page that contains the SWF content.
  • 對位於不同安全執行程序中的 SWF 檔,偵聽程式必須使用 LocalConnection.allowDomain() 方法,授予傳送者權限。您傳遞做為 LocalConnection.allowDomain() 方法之引數的字串可以包含下列任何項目:精確的網域名稱、IP 位址,以及 * 萬用字元。

     

  • top

    Trackback Address :: http://diary.tw/allenliao/trackback/313

    Write a comment