sandbox violation using AS3... PLEASE HELP!!!
i'm trying to embed a youtube video in my flash project using AS3.
it works, but i get an ugly error popup when it loads the video thumbnail.
if anyone can help me, i'll be eternally indebted! i've racked my brain and spent 4 hours on google trying to find a solution.
the error message is:
SecurityError: Error #2047: Security sandbox violation: parent: http://www.timesdaily.com/assets/multimedia/flash/10MTW/10MTW.swf cannot access http://s.ytimg.com/yt/swfbin/apiplayer3-vflgvMWON.swf.
at flash.display::DisplayObject/get parent()
at fl.managers::FocusManager/isTabVisible()
at fl.managers::FocusManager/tabEnabledChangeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.ui::UIElement/onAddedToStage()
at flash.display::DisplayObjectContainer/addChildAt()
at com.google.youtube.util::Layout/add()
at com.google.youtube.application::VideoApplication/setPlayButtonVisibility()
at com.google.youtube.application::VideoApplication/onAppStateChange()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.application::VideoApplication/setAppState()
at com.google.youtube.application::VideoApplication/cueVideoById()
at 10MTW_fla::MainTimeline/onPlayerReady()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.application::SwfProxy/onExternalEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.google.youtube.model::YouTubeEnvironment/broadcastExternal()
at com.google.youtube.application::VideoApplication/onInited()
at com.google.youtube.application::Application/initData()
at com.google.youtube.application::VideoApplication/initData()
at com.google.youtube.application::Application/init()
at com.google.youtube.application::VideoApplication/init()
at com.google.youtube.application::Application/onInit()
and my AS3 code:
this.stop();
mainmenusmall.addEventListener(MouseEvent.CLICK,mainmenubutton5);
function mainmenubutton5(evtObj:MouseEvent) {
//trace action shows what's happening in output menu
trace("The main menu button was clicked!");
//go to section command
my_player.stopVideo()
removeChild(my_loader)
gotoAndPlay(1);
}
Security.allowDomain("*");
var my_player:Object;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
my_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
function onLoaderInit(e:Event):void{
addChild(my_loader);
my_player = my_loader.content;
my_player.addEventListener("onReady", onPlayerReady);
}function onPlayerReady(e:Event):void{
my_player.setSize(350,275);
my_player.x = 10
my_player.y = 90;
my_player.cueVideoById("otrnWuhX9x8",23);
}play_btn.addEventListener(MouseEvent.CLICK, playVid);
function playVid(e:MouseEvent):void {
my_player.playVideo();
}
pause_btn.addEventListener(MouseEvent.CLICK, pauseVid);
function pauseVid(e:MouseEvent):void {
my_player.pauseVideo();
}closebtn.addEventListener(MouseEvent.CLICK, closeVid);
function closeVid(e:MouseEvent):void {
my_player.stopVideo()
removeChild(my_loader)
gotoAndPlay(4);
}
