보안 측면에서 차이가 있다고 생각하지 않습니다. 실제 컴파일이 시작되기 전에 MXXML이 mxmlc 컴파일러에 의해 ActionScript로 변환되므로 선언적 SWFLoader (또는 다른 모든 선언 요소)는 손으로 코딩하는 대신 단 순한 방법 일뿐입니다 . -compiler.keep-generated-actionscript
mxmlc 인수를 사용하여 MXML에서 어떤 코드가 생성되는지 확인할 수 있습니다.
그리고이 예에서 loader2.source = source;
행의 런타임 오류가 표시되지 않는 이유는 이전 코드 줄에서 오류가 발생했기 때문에 해당 함수의 실행이 중지 되었기 때문입니다. loader1.load(source)
이라고 부르는 행을 주석 처리하고 다음 행에서 이러한 종류의 SecurityError가 발생하는 것을 볼 수 있습니다.
SecurityError: Error #2148: SWF file http://example.com/test.swf cannot access local resource file:///Users/username/Desktop/picture.jpg. Only local-with-filesystem and trusted local SWF files may access local resources.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at mx.controls::SWFLoader/loadContent()
at mx.controls::SWFLoader/load()
at mx.controls::SWFLoader/commitProperties()
at mx.core::UIComponent/validateProperties()
at mx.managers::LayoutManager/validateProperties()
at mx.managers::LayoutManager/doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()
at mx.core::UIComponent/callLaterDispatcher()