<?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; Flash Actionscript</title>
	<atom:link href="http://jawad.pk/blog/category/flash-actionscript/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>Flash Percent Uploader with Symfony!</title>
		<link>http://jawad.pk/blog/2008/08/22/flash-percent-uploader-with-symfony/</link>
		<comments>http://jawad.pk/blog/2008/08/22/flash-percent-uploader-with-symfony/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 22:06:07 +0000</pubDate>
		<dc:creator>Jawad Khan</dc:creator>
				<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[filereference]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[percentage uploader]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://itsjawad.wordpress.com/?p=26</guid>
		<description><![CDATA[Flash Percent Uploader with Symfony! I just had to upload 40+mb of video file sizes to one of my recent project, For this purpose using simple form is obviously not a good choice as user never knows how much data has been transferred and how much left. So percent uploader was inevitable here, for this [...]]]></description>
			<content:encoded><![CDATA[<p>Flash Percent Uploader with Symfony!</p>
<p>I just had to upload 40+mb of video file sizes to one of my recent project, For this purpose using simple form is obviously not a good choice as user never knows how much data has been transferred and how much left. So percent uploader was inevitable here, for this purpose flash offers fileReference class which can be used to upload mutliple files to the server, with this filereference class you can get file size at onSelect event, so you can apply max-upload file size check and as well as you can monitor file transfer with onProgress event. The only problem while implementing the flash percent uploader is that you may recieve message like &#8220;A flash script is causing you computer to get slow! Would you like to abort it?&#8221;. The best way to avoid this error message is to make flash script busy in doing something else while uploading, it can be as simple as incrementing tmp variable.<br />
Also, you will definitely love to increase upload limit at server, For PHP you will change the following variables:<br />
upload_max_filesize = 50M<br />
post_max_size = 50M</p>
<p>Now it was as simple as it is for the non-symfony apps, The problem of using this with symfony app is that upload() method of fileReference class cannot initiate an action of the symfony application. On calling the action it does nothing, It does not even gives HTTP error 404 or anything like that, means it founds the path to the action (note that upload method returns true), but the action cannot communicate with it. So to overcome this problem, we will write our upload script in a file under web directory and we can call that script directly from the upload() method. like:-<br />
var item:FileReference = new FileReference();<br />
path_to_upload_script = &#8220;&#8230;&#8230;/uploader.php&#8221;;<br />
item.upload(path_to_upload_script); // note that the parameter path should be absolute</p>
<p>Now you may require to do some database activity, may need to create some criteria and doSelects, wondering if thats possible from the script in the web directory? Then yes its possible, instead using:<br />
sfContext::getInstance()-&gt;getController()-&gt;dispatch(); // that is used in index.php, we don&#8217;t need to dispatch the controller otherwise it will goto default homepage of our symfony app. We just need to get sfContext Instance. like:<br />
sfContext::getInstance();</p>
<p>Now you are ready to go, you can call the script and can communicate with the database as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://jawad.pk/blog/2008/08/22/flash-percent-uploader-with-symfony/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Flash with Symfony!</title>
		<link>http://jawad.pk/blog/2008/07/21/using-flash-with-symfony/</link>
		<comments>http://jawad.pk/blog/2008/07/21/using-flash-with-symfony/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 18:57:22 +0000</pubDate>
		<dc:creator>Jawad Khan</dc:creator>
				<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash communication symfony]]></category>
		<category><![CDATA[flash with symfony]]></category>
		<category><![CDATA[symfony with flash]]></category>

		<guid isPermaLink="false">http://itsjawad.wordpress.com/?p=15</guid>
		<description><![CDATA[well being a flash developer and being a symfony developer feels really good .. Anyways, Symfony is awsome framework for developing today&#8217;s web-applications with its nice and fine MVC architecture. So symfony developers and flash developers should know how they will work together seamlessly. First thing is to embed the flash into your template, we [...]]]></description>
			<content:encoded><![CDATA[<p>well being a flash developer and being a symfony developer feels really good <img src='http://jawad.pk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .. Anyways, Symfony is awsome framework for developing today&#8217;s web-applications with its nice and fine MVC architecture. So symfony developers and flash developers should know how they will work together seamlessly.<br />
First thing is to embed the flash into your template, we know that all the assets, graphics, javascripts, css etc belongs to the web folder of symfony&#8217;s project directory structure. So flash files will go here as well. I will recommend to create a folder named &#8216;flash&#8217; .</p>
<p>to embed the flash in your template, you will use same &lt;object&gt; tag as done in the normal html files, but ofcourse you will give the relative or absolute url of your flash src, for this purpose we can use functions like _compute_public_path(&#8230;) in symfony. it will take flash file&#8217;s parameters, like its name, extension and folder. this function returns the path which will be used for the embed source.</p>
<p>Now we are done with embeding, and now we will focus on data communication b/w flash and symfony, guess what its even more easier..  The right way to communicate data is in xml format. e.g. if my flash movie requires usernames and birthdays for all the members of my site, I will create an action specifically for the flash component, let&#8217;s say executeGetBirthdays(), i will create the template against the action as well.. Now i will put the xml generation logic in my action and i will print the resultant xml in my templateSuccess.php. Now I want the template to not to display irrelevant header and other info and just needs to start with the xml document root tag, so that my flash component can easily parse it. Therefore, I will put following line in the action:<br />
$this-&gt;setLayout(false);</p>
<p>Calling a symfony action from the flash is simple, just create an instance from the XML class..i.e<br />
x1 = new XML();//xml class rather<br />
x1.onLoad = function()<br />
{<br />
// xml parsing and rest of the stuff<br />
}</p>
<p>x1.load(&#8216;getBirthDays&#8217;);</p>
]]></content:encoded>
			<wfw:commentRss>http://jawad.pk/blog/2008/07/21/using-flash-with-symfony/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>
		<item>
		<title>Game development using Flash.</title>
		<link>http://jawad.pk/blog/2008/06/29/game-development-using-flash/</link>
		<comments>http://jawad.pk/blog/2008/06/29/game-development-using-flash/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 18:12:21 +0000</pubDate>
		<dc:creator>Jawad Khan</dc:creator>
				<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash games]]></category>
		<category><![CDATA[flash tutorial]]></category>
		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://itsjawad.wordpress.com/?p=5</guid>
		<description><![CDATA[Game development using Flash. hi readers, am writing this blog entry for those flash developers who want to get their hands into flash game development. I will use AS2.0 syntax for the examples. When I have to learn something then code snippets really help. So I will keep writing those sample codes, you can copy [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Game development using Flash.</strong></p>
<p>hi readers, am writing this blog entry for those flash developers who want to get their hands into flash game development. I will use AS2.0 syntax for the examples. When I have to learn something then code snippets really help. So I will keep writing those sample codes, you can copy / paste those in your Flash IDE and instantly experiment on them.<br />
<strong>Basic Maths</strong><br />
First of all, we need to learn basic Maths, I will not go deep into mathematics, so here is the guideline for basic maths<br />
-&gt; Learning basic geometry and basic coordinate system.<br />
-&gt; Learning basic trignometry,Learning sines, cosines and tangents and learning how to apply them.<br />
for instance, if you are given two points (x1, y1) and (x2,y2) on the plane, you should be able to findout the angle forming b/w those points w.r.t normal.</p>
<p><strong>Differences b/w Flash and cartesian coordinate system:</strong><br />
we need to clear out few differences between standard rules and flash rules. We are aware of Cartesian coordinate system, in which x represents horizontal axis and y represents vertical axis and the center point is (x=0,y=0). But in flash the point (0,0) lies at the top left corner of the stage and contrary to cartesian coordinate system the value of y increases as we go down.<br />
<strong>Getting position of the object:</strong><br />
We can retrieve and set the x and y values for any movieclip using movieclip&#8217;s class properties _x and _y.<br />
for instance:<br />
I can create a movieclip using createEmptyMovieClip method<br />
var container:MovieClip = this.createEmptyMovieClip(&#8220;container&#8221;, this.getNextHighestDepth());<br />
// then I create a textfield inside t he newly created movieclip.<br />
var label:TextField = container.createTextField(&#8220;label&#8221;, 1, 0, 0, 150, 20);<br />
label.text = &#8220;Hi boy&#8221;;</p>
<p>Now a movieclip &#8216;container&#8217; has been created on the stage and now we can get its x and y values. By default it&#8217;s x and y values are 0,0. You can confirm this using famous trace command.<br />
trace(container._x);<br />
trace(container._y);<br />
<strong>object movement and user interactivity</strong><br />
If you execute this code, you will see &#8220;hi boy&#8221; written at top left of the stage.<br />
Now you can easily change these values as well. Moreover if u want your movieclip &#8220;hi boy&#8221; to constantly change its position, you can use event &#8220;enterframe&#8221; like following:<br />
this.onEnterFrame=function()<br />
{<br />
container._x++;<br />
if(container._x &gt; 500)<br />
{<br />
container._x = 0;<br />
}<br />
}</p>
<p>This will keep movieclip container in a motion at x-axis. I put a condition cz it was neccessary otherwise container movieclip would have disappeared and left the stage for ever.<br />
Now instead putting textfield in the container object you can draw any shape or object and move it.<br />
In games, user interaction is must. You put user interactivity using various keyboard and mouse events. A simple key event can be used as follows:<br />
if (Key.isDown(Key.RIGHT)) {<br />
container._x++;<br />
}<br />
In the above example instead moving the object constantly, we are moving it whenever user presses &#8216;right&#8217; arrow key.<br />
Now it was the very basics of flash coordinates, object movements and user interactivity. stay tunned for the next releases.</p>
]]></content:encoded>
			<wfw:commentRss>http://jawad.pk/blog/2008/06/29/game-development-using-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

