i am trying to load (locally on my hard drive) one swf into another.
so i have just a simple swf in which i say this:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler, false, 0, true);
loader.load( new URLRequest("VideoDoc.swf") );
function completeHandler(e:Event):void {
addChild(loader);
}
this works fine.
but if i say this:
addChild(loader.content);//security sandbox violation pointing to completeHandler function.
i tried putting this:
Security.allowDomain("*"); in the completeHandler funtion but nothing changes.
where should i put this?
VideoDoc.swf is just the document class:
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.text.TextField;
import XMLLoader;
import StageSetup;
import VideoGallery;
public class VideoDoc extends MovieClip{
private var _xml:XML;
private var _xmlLoader:XMLLoader;
private var _videoGallery:VideoGallery;
private var _stageSetup:StageSetup;
private var _btnArr:Array;
private static var _stage:Stage;
public function VideoDoc() {
if (stage) {
init();// stage accessible, call init function
} else {
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);// call init when stage accessible
}
}
private function init(event:Event = null):void {
if (event) {// called via event, remove it
removeEventListener(Event.ADDED_TO_STAGE, init);
}
_stage = stage;
_stageSetup = new StageSetup(_stage);
_btnArr = [ up_mc, down_mc ];
load( "video gallery 2.xml" );
}
public function load( path:String ):void {
_xmlLoader = new XMLLoader( path );
_xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete, false, 0, true);
}
private function onXMLComplete(e:Event):void {
_xmlLoader.removeEventListener(Event.COMPLETE, onXMLComplete);
_xml = new XML(_xmlLoader.getXML());
//trace(_xml);
_videoGallery = new VideoGallery( _xml, _btnArr, popup_mc, upBar_mc, downBar_mc, info_mc );
var index:int = this.getChildIndex(this.getChildByName("popup_mc"));
//trace(index);
addChildAt(_videoGallery, index);
}
public static function getStage():Stage {
return _stage;
}
public function destroy():void {
if(_videoGallery){
removeChild(_videoGallery);
_videoGallery = null;
}
}
}
}