5/7/2010 4:34:11 PM
Title:
Popup Windows and Youtube player
Hi All,
I am playing youtube in my TitleWindow. The problem is even if I close the popu Window still the youtube player is playing , I can not see the video but the sound is coming . Here is the code.
Thanks for your help
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="485" height="408" title="About" showCloseButton="true"
close=" youtubevid=null; PopUpManager.removePopUp(this) " initialize="init()" >
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function init():void
{
var url:String = "http://www.youtube.com/v/zlfKdbWwruY&hl=en&fs=1";
Security.allowDomain(url);
youtubevid.load(url);
youtubevid.
}
]]>
</mx:Script>
<mx:SWFLoader id="youtubevid" verticalAlign="top" horizontalAlign="center" width="100%" height="80%" />
</mx:TitleWindow>
5/8/2010 12:01:08 AM
if you need full control on youtube videos you can use the google's youtube API for flash , here is an example to use it :
http://code.google.com/p/gdata-samples/source/browse/trunk/ytplayer/actionscript3/com/google/youtube/example/AS3Player.as
5/8/2010 2:30:26 AM
you can try using this actionscript code to stop youtube player audio after unloading
youtubevid.unloadAndStop(true);
SoundMixer.stopAll();
5/8/2010 7:00:58 AM
Thanks Otis for the link . I have to check that.
HMS Ji , Thanks for your response . There is no function unloadAndStop in SWFLoader . and the soundmixed alone not helped me .I am using flex 3
Regards
Bujji
Rayan
Points: 700
Posts:0
5/8/2010 7:11:25 AM
unloadAndStop(true); this function is available if you compile your application for flash player 10 and above. else you can try removeChild(youtubevid);
5/8/2010 10:11:37 AM
Even If I use removechild , It didn't work . Still the back ground song is coming up. Here is the code I am using
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="485" height="408" title="About" showCloseButton="true"
close=" removeChild(youtubevid);
SoundMixer.stopAll();
PopUpManager.removePopUp(this) " initialize="init()" >
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function init():void
{
var url:String = "http://www.youtube.com/v/zlfKdbWwruY&hl=en&fs=1";
Security.allowDomain(url);
youtubevid.load(url);
}
]]>
</mx:Script>
<mx:SWFLoader id="youtubevid" verticalAlign="top" horizontalAlign="center" width="100%" height="80%" />
</mx:TitleWindow>