<?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>jek2kdotcom &#187; Flash</title>
	<atom:link href="http://www.jek2k.com/wp/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jek2k.com/wp</link>
	<description>still awake at night?</description>
	<lastBuildDate>Thu, 12 May 2011 10:33:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash-PHP: how to get the server&#8217;s date and time</title>
		<link>http://www.jek2k.com/wp/2008/06/25/flash-php-how-to-get-the-servers-date-and-time/</link>
		<comments>http://www.jek2k.com/wp/2008/06/25/flash-php-how-to-get-the-servers-date-and-time/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 14:51:34 +0000</pubDate>
		<dc:creator>Nicolò</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jek2k.com/wp/index.php/2008/06/25/flash-php-how-to-get-the-servers-date-and-time/</guid>
		<description><![CDATA[Today a fellow designer asked me how to retrieve the server&#8217;s date and time using Flash.
Since Flash is executed on the client, it reads the date and time of the client. The easiest way I could think of was using a bit of PHP.
We use PHP to get the server&#8217;s date and time, and then [...]]]></description>
			<content:encoded><![CDATA[<p>Today a fellow designer asked me how to retrieve the server&#8217;s date and time using Flash.<br />
Since Flash is executed on the client, it reads the date and time of the client. The easiest way I could think of was using a bit of PHP.<br />
We use PHP to get the server&#8217;s date and time, and then pass the value on to Flash using a flashvar.</p>
<p>Since I had to do this for a colleague, I&#8217;m sharing the final script here, in case someone else needs it.</p>
<p><a href="http://playground.gnvpartners.net/ex/remote_date/">See a working example</a> or <a href="http://playground.gnvpartners.net/ex/remote_date/remote_date.zip">download the source files</a> (24kb, ZIP, comments in italian only).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jek2k.com/wp/2008/06/25/flash-php-how-to-get-the-servers-date-and-time/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Cryptography and Flash</title>
		<link>http://www.jek2k.com/wp/2007/05/22/cryptography-and-flash/</link>
		<comments>http://www.jek2k.com/wp/2007/05/22/cryptography-and-flash/#comments</comments>
		<pubDate>Mon, 21 May 2007 22:23:22 +0000</pubDate>
		<dc:creator>Nicolò</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.jek2k.com/wp/index.php/2007/05/09/cryptography-and-flash/</guid>
		<description><![CDATA[Many times, when you&#8217;re developing a rich Flash app, or more frequently an advanced Flash website, you have to deal with login forms to authenticate users.
And maybe you want to store your encrypted password in a database, and then retrieve them using some server-side script.
Or you want to send an encrypted string back to the [...]]]></description>
			<content:encoded><![CDATA[<p>Many times, when you&#8217;re developing a rich Flash app, or more frequently an advanced Flash website, you have to deal with login forms to authenticate users.<br />
And maybe you want to store your encrypted password in a database, and then retrieve them using some server-side script.<br />
Or you want to send an encrypted string back to the database.</p>
<p>In a scenario like this, you might want (or need) to decrypt encrypted password or string in order to obtain readable data. ActionScript, by default, can&#8217;t handle it. </p>
<p>I found an interesting solution provided by <a href="http://www.meychi.com/archive/000031.php">Meychi</a>, called ASCrypt.<br />
It is simple Flash Extension that enables crypting and decrypting functions in ActionScript. It provides classes with methods to crypt and decrypt strings and support all the following standards: Base8, Base64, Goauld, LZW, GUID, RC4, MD5, SHA1, ROT13, Rijndael and TEA.<br />
It is quite easy to use and works great with both ActionScript and ActionScript 2.0.</p>
<p>Anyway, I&#8217;m going to show you a really basic example of how to pass an encrypted password from a server-side ASP.NET page to a SWF movie. </p>
<p>Let&#8217;s make a stupid ASP.NET script that encrypts a given password and passes the obtained string to Flash.</p>
<p><strong>encrypted_pass.aspx</strong><br />
<pre><pre>
&lt;% 
&#039;sets a variable containing our password 
Dim PassWord = &quot;pass&quot;
 
&#039;encrypts the password to a Base64 string
Response.Write(&quot;pwd=&quot;+Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(PassWord))) 
%&gt; 
</pre></pre> </p>
<p>These few lines of script take a simple variable (PassWord) and encrypt it to a Base64 string.<br />
If you view it in a browser, you&#8217;ll see an output like pwd=cGFzcw==.</p>
<p><strong>decrypt_pass.fla</strong><br />
<pre><pre>
// imports Meychi&#039;s ASCrypt class
import com.meychi.ascrypt.*;

// creates a LoadVars object to handle loaded external data
this.pwdLoader = new LoadVars();

// function to be called when external data is loaded into Flash
this.pwdLoader.onLoad = function(success) {
&nbsp;&nbsp;// checks if loading was succesful and external file contains data
&nbsp;&nbsp;if (success &amp;&amp; pwdLoader.pwd != &quot;&quot; &amp;&amp; pwdLoader.pwd != undefined) {
&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;// decrypts the password retrieved from the external file
&nbsp;&nbsp;&nbsp;&nbsp;// and outputs the original string
&nbsp;&nbsp;&nbsp;&nbsp;trace(&quot;PASSWORD= &quot;+Base64.decode(pwdLoader.pwd));
&nbsp;&nbsp;}
};

// loads the external .aspx file
this.pwdLoader.load(&quot;encrypted_pass.aspx&quot;);
</pre></pre></p>
<p>Save your Flash file and test it. The output panel will show PASSWORD = pass, so it gets back to the original value.</p>
<p>This is a really simple example, but shows how easy it is to handle encrypted data with the ASCrypt class.</p>
<p>You can download the ASCrypt Extension (.mxp file) and some sample Flash files from <a href="http://www.meychi.com/archive/000031.php">Meychi&#8217;s website</a>.</p>
<p style="text-align:center;"><a href="http://www.jek2k.com/wp/wp-content/uploads/2007/05/ascrypt_sample.zip"><img class="no-border" src="http://www.jek2k.com/wp/wp-content/uploads/2007/05/btn_source_down.png" alt="Download Source Code" /></a></p>
<p>Here is the source code for the example:<br />
<a href="http://www.jek2k.com/wp/wp-content/uploads/2007/05/ascrypt_sample.zip" title="ascrypt_sample.zip">Download ascrypt_sample.zip (28k ZIP)</a></p>
<p>&nbsp;</p>
<p class="note">This tutorial is provided as is. Please do not email me questions or support requests about the scripts contained in this page. Use the comments below instead. Thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jek2k.com/wp/2007/05/22/cryptography-and-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

