After that, I created an AIR2.0 program, called player.swf, and use it to load e-Notice.swf:
Code:
function startLoad()
{
var conText:LoaderContext = new LoaderContext();
conText.allowLoadBytesCodeExecution = true;
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("h t t p : / /l ocalhost/shadow-enotice-cms/e-Notice.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event)
{
removeChild(perTxt);
addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = (mProgress.bytesLoaded/mProgress.bytesTotal)*100;
perTxt.text = percent + "%";
}
startLoad();
The problem: when I played e-Notice.swf in AIR, something didn't work.
If I test the Air Movie in Flash CS5, I got some prompt:
Warning: Ignoring 'secure' attribute in policy file from fpdownload.adobe.com/pub/swz/crossdomain.xml. The 'secure' attribute is only permitted in HTTPS and socket policy files. See ... for details.
[SWF] /shadow-enotice-cms/e-Notice.swf/[[DYNAMIC]]/3 - 5445151 bytes after decompression
*** Security Sandbox Violation ***
SecurityDomain 'localhost/shadow-enotice-cms/e-Notice.swf' tried to access incompatible context 'app:/player.swf'
*** Security Sandbox Violation ***
SecurityDomain '/localhost/shadow-enotice-cms/e-Notice.swf' tried to access incompatible context 'app:/player.swf'
SecurityError: Error #2070: Security sandbox violation: caller localhost/shadow-enotice-cms/e-Notice.swf/[[DYNAMIC]]/3 cannot access Stage owned by app:/player.swf.
at flash.display::Stage/requireOwnerPermissions()
at flash.display::Stage/addEventListener()
at fl.text::TLFTextField/invalidate()[F:\stage\Flash11_Main_485_Stage\main\authortool\St age\tlfRuntime\fl\text\TLFTextField.as:789]
at fl.text::TLFTextField/setSelection()[F:\stage\Flash11_Main_485_Stage\main\authortool\St age\tlfRuntime\fl\text\TLFTextField.as:5768]
at fl.text::TLFTextField/switchToEditingMode()[F:\stage\Flash11_Main_485_Stage\main\authortool\St age\tlfRuntime\fl\text\TLFTextField.as:6185]
at fl.text::TLFTextField/replaceText()[F:\stage\Flash11_Main_485_Stage\main\authortool\St age\tlfRuntime\fl\text\TLFTextField.as:5650]
at fl.text::TLFTextField/set text()[F:\stage\Flash11_Main_485_Stage\main\authortool\St age\tlfRuntime\fl\text\TLFTextField.as:3961]
at e_fla::eNoticeContent_1/onConXMLLoaded()[e_fla.eNoticeContent_1::frame1:69]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()