<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jawad.pk &#187; moviecliploader</title>
	<atom:link href="http://jawad.pk/blog/tag/moviecliploader/feed/" rel="self" type="application/rss+xml" />
	<link>http://jawad.pk/blog</link>
	<description>WEB 2.0 / RIAs Expert.</description>
	<lastBuildDate>Tue, 06 Sep 2011 12:43:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Loading / unloading youtube videos in flash</title>
		<link>http://jawad.pk/blog/2008/07/09/loading-unloading-youtube-videos-in-flash/</link>
		<comments>http://jawad.pk/blog/2008/07/09/loading-unloading-youtube-videos-in-flash/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 20:35:53 +0000</pubDate>
		<dc:creator>Jawad Khan</dc:creator>
				<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[loading youtube videos]]></category>
		<category><![CDATA[moviecliploader]]></category>
		<category><![CDATA[youtube in flash]]></category>

		<guid isPermaLink="false">http://itsjawad.wordpress.com/?p=7</guid>
		<description><![CDATA[Loading / unloading youtube videos in flash Hi dear readers, I recently loaded youtube videos in a flash project, it was quite straight forward, but however there was a issue when unloading the videos, cz if you donot unload the movie, it will keep playing and its sound will keep coming out, despite the fact [...]]]></description>
			<content:encoded><![CDATA[<p>Loading / unloading youtube videos in flash</p>
<p>Hi dear readers, I recently loaded youtube videos in a flash project, it was quite straight forward, but however there was a issue when unloading the videos, cz if you donot unload the movie, it will keep playing and its sound will keep coming out, despite the fact you transfer control to anywhere at the movie.</p>
<p>So, I searched the forums, but I could&#8217;nt found the solution. Lots of guys are facing this issue. So, here is the solution:</p>
<p>// The first thing to load any external MC,<br />
// is to create an instance of movieclipLoader Class.</p>
<p>var video_mcl:MovieClipLoader = new MovieClipLoader();</p>
<p>// Now you will like to create a container where the MC will actually load.</p>
<p>this.createEmptyMovieClip(&#8220;container&#8221;,this.getNextHighestDepth());</p>
<p>// Create a listener object</p>
<p>var mclListener:Object = new Object();</p>
<p>// add it to the movieClipLoader object</p>
<p>video_mcl.addListener(mclListener);</p>
<p>// onLoadInit will be triggered when the external MC is ready. So its nice place to set new MC dimensions etc.</p>
<p>mclListener.onLoadInit = function(target_mc:MovieClip) {<br />
// set dimensions or anything..</p>
<p>}</p>
<p>// now assign youtube&#8217;s movie id and create complete URL to load from.<br />
utube_id = &#8220;UfMglbWyX4I&#8221;;<br />
full_address = &#8220;http://www.youtube.com/v/&#8221; + utube_id;</p>
<p>//eventually use loadClip function<br />
video_mcl.loadClip(full_address, container);</p>
<p>Now your youtube MC is loaded and its playing by default. Now you have to unload it or close it.</p>
<p>The first thing that will come to flash developer&#8217;s mind is  movieClipLoader&#8217;s class unloadClip function:-</p>
<p>i.e:</p>
<p>video_mcl.unloadClip(container); // but unfortunately that doesnot work to unload youtube&#8217;s MC.</p>
<p>Secondly, you can try removing the container MC which contains the loaded content<br />
i.e:</p>
<p>container.removeMovieClip() // but unfortunately you cannot explicity remove the container MC.</p>
<p>so last but not the least, you will try to atleast stop the sound and will use global function, i.e:</p>
<p>stopAllSounds(); // but that will work for the FLASH IDE, but after publishing it wont hav any affect..</p>
<p>So here is the tip, when you load the youtube MC in your container, then your container reacts as a youtube player.. Infact its the youtube player now and you can control all of youtube&#8217;s api functions available with that container object..<br />
So simply doing:</p>
<p>container.stopVideo(); // will stop the video and its sound.</p>
<p>you can use all other functions with the container instance as well..<br />
Hope it helps to all who got stucked with this issue..<br />
cheers<br />
Jawad.</p>
]]></content:encoded>
			<wfw:commentRss>http://jawad.pk/blog/2008/07/09/loading-unloading-youtube-videos-in-flash/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

