<?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>Under Development :: Life in the Virtual World &#187; Flash</title>
	<atom:link href="http://underdevelopment.maravillaclan.net/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://underdevelopment.maravillaclan.net</link>
	<description>Learning to do it a little better</description>
	<lastBuildDate>Wed, 09 Dec 2009 12:23:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash CMS v0.0.1</title>
		<link>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/</link>
		<comments>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 12:19:53 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=217</guid>
		<description><![CDATA[This was a proof of concept we sent to our client requesting dynamic content for Flash media plus a web based editor for the content.
At first glance it seems as if they are asking for something that could take months to develop. However, it&#8217;s actually simple enough that could be done by patching one component [...]]]></description>
			<content:encoded><![CDATA[<p>This was a proof of concept we sent to our client requesting dynamic content for Flash media plus a web based editor for the content.</p>
<p>At first glance it seems as if they are asking for something that could take months to develop. However, it&#8217;s actually simple enough that could be done by patching one component from another. Done with one cup of coffee.</p>
<p>Flash supports HTML. But don&#8217;t get too excited. Flash only supports some basic tags. All you need then is to be able to push data to it. You could do this with several methods. One would be using LoadVars. Another one is the good old FlashVars and lastly through XML.</p>
<p>With this example we&#8217;re using LoadVars. Below are the only lines of codes you need to do a simple CMS.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Simple just declare a text area contains an HTML markup</span>
_root.<span style="color: #660066;">content</span>.<span style="color: #660066;">html</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Load the content</span>
<span style="color: #003366; font-weight: bold;">var</span> contentVars <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> LoadVars<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
contentVars.<span style="color: #000066;">onLoad</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ok<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ok<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    _root.<span style="color: #660066;">content</span>.<span style="color: #660066;">htmlText</span> <span style="color: #339933;">=</span> contentVars.<span style="color: #660066;">flash_content</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// load the file (use .php extension to avoid browsers from caching the content)</span>
<span style="color: #006600; font-style: italic;">// no worries cause the content is encoded and no php script</span>
<span style="color: #006600; font-style: italic;">// could be executed with this process</span>
contentVars.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;flash_content.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// this is just to keep flash from running away</span>
<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You might wonder why not just use Flash XML feature instead of LoadVars. Well that could be done also. It&#8217;s just what I felt doing at the time. Also since I was using php as my file extension XML might not be the right choice as it exposes some security holes.</p>
<p>Next step is the What-You-See-Is-What-You-Get editor (WYSIWYG). There are lots available in the net. For this example I used <a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a>. You would need to configure or do some hack to make the editor only use the tags supported by Flash. List of supported tags could be found in <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808" target="_blank">http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808.</a></p>
<p>Once you get that done next step is to push the content of the editor to Flash. This is where PHP plays its role. Of course you could use other server side scripting in place of it.</p>
<p>The result would be something like <a title="Flash CMS sample" href="http://webtools.maravillaclan.net/flash_cms/" target="_blank">this (Flash CMS sample)</a>. Go ahead and try it. You may also download the source files to modify and maybe improve it.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing older version of Flash</title>
		<link>http://underdevelopment.maravillaclan.net/2007/11/07/installing-older-version-of-flash/</link>
		<comments>http://underdevelopment.maravillaclan.net/2007/11/07/installing-older-version-of-flash/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 05:53:37 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=9</guid>
		<description><![CDATA[Problem:
Switching between Flash versions could sometimes be tricky.   We needed to check the compiled Flash application in an older version which is Flash Player v6. The problem is that once you installed the latest version it&#8217;s hard to revert back to the previous version.
Solution:
The  solution to this problem can be found at [...]]]></description>
			<content:encoded><![CDATA[<p>Problem:<br />
Switching between Flash versions could sometimes be tricky.   We needed to check the compiled Flash application in an older version which is Flash Player v6. The problem is that once you installed the latest version it&#8217;s hard to revert back to the previous version.</p>
<p>Solution:<br />
<span id="more-9"></span>The  solution to this problem can be found at <a href="http://kb.adobe.com/" target="_blank">kb.adobe.com</a>. You first need to uninstall the Flash Player that&#8217;s already in the system. You would find the uninstaller <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157&amp;sliceId=2" target="_blank">here</a>. After that is done just download and install the older version archived <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&amp;sliceId=2" target="_blank">here</a>.</p>
<p>Note:<br />
This appear to work with IE but not with Firefox. For Firefox users there is an even more convenient way. There is an add-on called Flash Switcher available at <a href="http://www.sephiroth.it/firefox/" target="_blank">sephiroth.it</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2007/11/07/installing-older-version-of-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash BitmapData&#8217;s 2880 px Limit Workaround</title>
		<link>http://underdevelopment.maravillaclan.net/2007/11/06/flash-bitmapdatas-2880-px-limit-workaround/</link>
		<comments>http://underdevelopment.maravillaclan.net/2007/11/06/flash-bitmapdatas-2880-px-limit-workaround/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 06:25:47 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=7</guid>
		<description><![CDATA[Problem:
We were developing a specialized application for a client. This application should be able to take an image template and allow users to customize (move/crop pictures, add message, etc.). To produce a good enough resolution acceptable for printing the application needs to handle templates as large as  2138&#215;3038 pixels. Adobe Flash limits developers from [...]]]></description>
			<content:encoded><![CDATA[<p>Problem:<br />
We were developing a specialized application for a client. This application should be able to take an image template and allow users to customize (move/crop pictures, add message, etc.). To produce a good enough resolution acceptable for printing the application needs to handle templates as large as  2138&#215;3038 pixels. Adobe Flash limits developers from creating BitmapData with width or height larger than 2880 pixels. Bad news. Try creating a Bitmap greater than the specified limit and you&#8217;ll get this error:</p>
<p>ArgumentError: Error #2015: Invalid BitmapData.</p>
<p>This will work:<br />
<font color="#0000ff">var </font>ValidBitmapData:<font color="#0000ff">BitmapData </font>= <font color="#0000ff">new BitmapData</font>(2880, 2880);</p>
<p>This won&#8217;t:<br />
<font color="#0000ff">var </font>InvalidBitmapData:<font color="#0000ff">BitmapData </font>= <font color="#0000ff">new BitmapData</font>(3000, 3000);</p>
<p>According to <a href="http://www.adobe.com/devnet/flash/articles/image_api_02.html" target="_blank">www.adobe.com</a>:<br />
<font color="#99ccff"> The maximum dimensions of a bitmap in Flash Player is limited to 2880 pixels in either direction (width or height). If you attempt to create a BitmapData instance that is larger than this restriction, the Bitmap will not be created. This limit is in place to keep people from creating Flash movies that gobble up the client&#8217;s RAM. A bitmap that is 2880 x 2880 pixels, will use roughly 32MB of RAM.</font></p>
<p>This restriction becomes more and more useless as computer hardware becomes more and more capable.</p>
<p>Solution:<br />
<span id="more-7"></span>The trick is to &#8220;kidnap&#8221; a BitmapData object from a loaded image with dimension over the limit of 2880 pixels (Which flash allows. Huh! Yes Flash can actually handle bitmaps larger the the limit. It just doesn&#8217;t let you create one.).</p>
<p>It&#8217;s simple. Create a dummy image with the dimension you need. Save it and make it accessible to Flash. Dynamically load it using ActionScript. And take the loader object&#8217;s BitmapData object. That&#8217;s why I termed it &#8220;kidnap&#8221;. We are actually just taking the child of the parent object(loader object), which is the BitmapData, and use it like we build it ourselves.</p>
<p>&#8212;<br />
// 1. Create an image loader and<br />
<font color="#0000ff">var </font>DummyImageLoader:Loader = <font color="#0000ff">new Loader</font>;</p>
<p>// 2. Assign a function to &#8220;kidnap&#8221; the BitmapData object<br />
DummyImageLoader.<font color="#0000ff">contentLoaderInfo</font>.<font color="#0000ff">addEventListener</font>(<font color="#0000ff">Event</font>.<font color="#0000ff">COMPLETE</font>, DummyImageOnComplete);</p>
<p>// 3. Load the image with the preferred dimension<br />
<font color="#0000ff">var </font>DummyImageRequest:<font color="#0000ff">URLRequest </font>= <font color="#0000ff">new URLRequest</font>(<font color="#00ff00">&#8220;dummy_image.jpg&#8221;</font>);<br />
DummyImageLoader.load(DummyImageRequest);</p>
<p><font color="#0000ff">function </font>DummyImageOnComplete(evt:<font color="#0000ff">Event</font>):<font color="#0000ff">void</font><br />
{<br />
<font color="#0000ff">var </font>DummyImageBitmap  = <font color="#0000ff">Bitmap</font>(DummyImageLoader.content);<br />
// &#8220;kidnap&#8221; the BitmapData object<br />
<font color="#0000ff">var </font>ValidBitmapData:<font color="#0000ff">BitmapData  </font>= DummyImageBitmap.<font color="#0000ff">bitmapData</font>;</p>
<p>// you can now use ValidBitmapData to draw any element larger than 2880&#215;2880<br />
}<br />
&#8212;</p>
<p>This will then allow you to use ValidBitmapData as you would have when you used this line:</p>
<p><font color="#0000ff">var </font>InvalidBitmapData:<font color="#0000ff">BitmapData </font>= <font color="#0000ff">new BitmapData</font>(3000, 3000);</p>
<p>Only this time it works.</p>
<p>Files:  <a href="http://underdevelopment.maravillaclan.net/wp-content/uploads/2007/11/bitmapdata_workaround.zip" title="bitmapdata_workaround.zip">bitmapdata_workaround.zip</a></p>
<p>Source:<br />
Original Solution (I believe nobody have used this workaround before.)</p>
<p>Note:<br />
If the required BitmapData dimension varies too often you could generate the image dynamically. In our site we used a PHP script utilizing GD library to create the dummy images. Calling the script like this: dummy_jpeg.php?w=3000&amp;h=3000 where w is the width and h the hieght in pixels.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2007/11/06/flash-bitmapdatas-2880-px-limit-workaround/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
