'SecurityError'相關日誌共 1 篇

  1. 2007/10/04 AS3 load AS2 Aand edit(crossScripting?) (1)

AS3 load AS2 Aand edit(crossScripting?)

ActionScript3.0 2007/10/04 02:45

首先在domain1.com放置一個由AS3編寫的main.swf
再第一影格程式碼如下

var loader3:Loader=new Loader();//載AS2 SWF
var URLrequest3:URLRequest=new URLRequest("
http://domain2.com/AS2movie.swf");
loader3.contentLoaderInfo.addEventListener(Event.COMPLETE,gotit);
//loader2.load(URLrequest2, new LoaderContext(true,null,null))
loader3.load(URLrequest3);
loader3.y=200;
this.addChild(loader3);
function gotit(e:Event) {
 trace("AD TYPE:"+e.target.contentType);
 trace("e.target:"+e.target.content)
 var w:Number=100;
 var h:Number=100;
 e.target.content.width=w;
 e.target.content.height=h;
 /*
 if (e.target.contentType=="application/x-shockwave-flash" ) {
  var ADP_obj:Object=new Object();
  ADP_obj.w=w;
  ADP_obj.h=h;
  conn.send("setAD_conn", "setADProperty_fun", ADP_obj);
 } else {
  e.target.content.width=w;
  e.target.content.height=h;
  loader.visible=true;
 }*/
}


在domain2.com放置一個由AS2編寫的AS2movie.swf再第一影格程式碼如下

System.security.allowDomain("*");
/*
var conn:LocalConnection = new LocalConnection();
conn.allowDomain = function(sendingDomain:String) {
 trace("sendingDomain:"+sendingDomain)
    return true;
};
conn.Stageobj=this
conn.setADProperty_fun = function(ADP_obj:Object) {
 trace("someone call me!!!")
    this.Stageobj._width=ADP_obj.w
 this.Stageobj._height=ADP_obj.h
};
conn.connect("setAD_conn");
*/

結果我收到下列的錯誤訊息
SecurityError: Error #2121: Sandbox 安全性違規:LoaderInfo.content:http://domain1.com/main.swf 無法存取 http://domain2.com/AS2movie.swf。這問題可以藉呼叫 Security.allowDomain 解決。
 at flash.display::LoaderInfo/get content()
 at loadpic_fla::MainTimeline/gotit()





 

top

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

  1. [coach outlet] 2012/04/27 08:03 MODIFY/DELETE REPLY

    coach outlet has a zippered closure and buckles for extra security. Shiny brass hardware, rounded leather handle, and an interior pocket. It also includes a limited edition Hawaii luggage tag and lock.This summer,?coach outlet store online combined with Chinese style, the international trend of the subversive elements in bold, the idea of ?weaving in elements in the interpretation of low-carbon fashion casual.As our Coach Outlet Online guarantees high quality for you, we have gained more customers'trust. The more they order, the more discounts they will enjoy.

Write a comment