<?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>FlashFuck.it &#187; Flash Player 10</title>
	<atom:link href="http://www.flashfuck.it/category/flash-player/astro/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flashfuck.it</link>
	<description>flash platform, gaming and 3D</description>
	<lastBuildDate>Mon, 23 Jan 2012 18:11:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>BitmapData and Stage size limit</title>
		<link>http://www.flashfuck.it/2010/11/18/bitmapdata-and-stage-size-limit/</link>
		<comments>http://www.flashfuck.it/2010/11/18/bitmapdata-and-stage-size-limit/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 15:42:13 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[Stage]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=201</guid>
		<description><![CDATA[Short tips post BitmapData size limit: Up to flash 9 the size limit for a BitmapData object was 4096&#215;4096 pixels. With flash player 10 that limit was removed, but what does this exactly mean? May we be able to create 4097&#215;4097 sized bitmapdata instances? the answer is NO, we can&#8217;t. I just found an official [...]]]></description>
			<content:encoded><![CDATA[<p>Short tips post <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>BitmapData size limit:</strong><br />
Up to flash 9 the size limit for a BitmapData object was 4096&#215;4096 pixels.<br />
With flash player 10 that limit was removed, but what does this exactly mean? May we be able to create 4097&#215;4097 sized bitmapdata instances? the answer is NO, we can&#8217;t.<br />
I just found an official explanation of that here <a href="http://kb2.adobe.com/cps/496/cpsid_49662.html" target="_blank">http://kb2.adobe.com/cps/496/cpsid_49662.html</a></p>
<p>Just in case you don&#8217;t have the time\will to read it:<br />
- we still have a limit!<br />
- the limit is set to the maximum amount of pixels (16,777,215 (the decimal equivalent of 0xFFFFFF))<br />
- the maximum valid size of the bounding rectangle side is 8191</p>
<p><strong>Stage size limit:</strong><br />
It actually depends on the stage quality.<br />
With a high quality set the bound limit is 4050&#215;4050, if your content exceeds it gets cropped.<br />
With a low or medium quality the bound limit increases, there&#8217;s no official documentation about that (or at least I didn&#8217;t find it).<br />
Note that Adobe&#8217;s saying that &#8220;graphic artifacts&#8221; could be displayed when our stage &#8220;approaches&#8221; 3840 pixels range.</p>
<p>have fun <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/11/18/bitmapdata-and-stage-size-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Graphics Unleashed at WebTech</title>
		<link>http://www.flashfuck.it/2010/11/10/flash-graphics-unleashed-at-webtech/</link>
		<comments>http://www.flashfuck.it/2010/11/10/flash-graphics-unleashed-at-webtech/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 08:58:49 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[TheFlashMind]]></category>
		<category><![CDATA[WebTechCon]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=198</guid>
		<description><![CDATA[As my previous post was announcing, cancelling and reannouncing, I&#8217;m speaking at WebTech Conference here in Milan. Here&#8217;s my presentation slides Webtech Conference Italy 2010 &#8211; Flash Graphics Unleashed View more presentations from Piergiorgio Niero. And here&#8217;s the examples zip: www.flashfuck.it/webtech/examples.zip If you need something to be more clear or some further explanation please feel [...]]]></description>
			<content:encoded><![CDATA[<p>As my previous post was announcing, cancelling and reannouncing, I&#8217;m speaking at WebTech Conference here in Milan.<br />
Here&#8217;s my presentation slides</p>
<div style="width:425px" id="__ss_5723876"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/piergiorgioniero/webtech-conference-italy-2010-flash-graphics-unleashed" title="Webtech Conference Italy 2010 - Flash Graphics Unleashed">Webtech Conference Italy 2010 &#8211; Flash Graphics Unleashed</a></strong><object id="__sse5723876" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webtech-101110024248-phpapp01&#038;stripped_title=webtech-conference-italy-2010-flash-graphics-unleashed&#038;userName=piergiorgioniero" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse5723876" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=webtech-101110024248-phpapp01&#038;stripped_title=webtech-conference-italy-2010-flash-graphics-unleashed&#038;userName=piergiorgioniero" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/piergiorgioniero">Piergiorgio Niero</a>.</div>
</div>
<p>And here&#8217;s the examples zip: <a href="http://www.flashfuck.it/webtech/examples.zip">www.flashfuck.it/webtech/examples.zip</a><br />
If you need something to be more clear or some further explanation please feel free to comment this post <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/11/10/flash-graphics-unleashed-at-webtech/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BitmapData manipulation benchmark</title>
		<link>http://www.flashfuck.it/2009/07/15/bitmapdata-manipulation-benchmark/</link>
		<comments>http://www.flashfuck.it/2009/07/15/bitmapdata-manipulation-benchmark/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 19:54:49 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[BitmapData]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=144</guid>
		<description><![CDATA[Today I encountered this blog post from Zevan (which blog is REALLY a good daily reading I suggest everyone to take) about bitmapData merging and I started tweaking some code doing some benchmarks to find out which way is the most performing. Here are my tests: First strike (Zevan&#8217;s one): copyPixels [SWF(width=650, height=650)] var loader:Loader [...]]]></description>
			<content:encoded><![CDATA[<p>Today I encountered <a href="http://actionsnippet.com/?p=1760">this blog post from Zevan</a> (which blog is REALLY a good daily reading I suggest everyone to take) about bitmapData merging and I started tweaking some code doing some benchmarks to find out which way is the most performing. Here are my tests:</p>
<p>First strike (Zevan&#8217;s one): <strong>copyPixels</strong></p>
<pre lang="actionscript">
[SWF(width=650, height=650)]
var loader:Loader = new Loader();
loader.load(new URLRequest("http://actionsnippet.com/wp-content/chair.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
var w:Number;
var h:Number;
var rows:Number = 20;
var cols:Number = 20;
var tiles:Vector.<BitmapData> = new Vector.<BitmapData>();
var locX:Vector.<Number> = new Vector.<Number>();
var locY:Vector.<Number> = new Vector.<Number>();
var rX:Vector.<Number> = new Vector.<Number>();
var rY:Vector.<Number> = new Vector.<Number>();
var sX:Vector.<Number> = new Vector.<Number>();
var sY:Vector.<Number> = new Vector.<Number>();
function onLoaded(evt:Event):void{
	w = evt.target.width;
	h = evt.target.height;
	var image:BitmapData = Bitmap(evt.target.content).bitmapData;
	var tileWidth:Number = w / cols;
	var tileHeight:Number = h / rows;
	var inc:int = 0;
	var pnt:Point = new Point();
	var rect:Rectangle = new Rectangle(0,0,tileWidth,tileHeight);
	var startTime:Number = getTimer();
	for (var i:int = 0; i<rows; i++){
		for (var j:int = 0; j
<cols; j ++){
			 var currTile:BitmapData= new BitmapData(tileWidth, tileHeight, true, 0x00000000);
			 rect.x = j * tileWidth;
			 rect.y = i * tileHeight;
			 currTile.copyPixels(image, rect, pnt, null, null, true);
			 tiles[inc] = currTile;
			 rect.x += 25;
			 rect.y += 25;
			 sX[inc] = rect.x;
			 sY[inc] = rect.y;
			 locX[inc] = rX[inc] = -rect.width * 2
			 locY[inc] = rY[inc] =  Math.random() * stage.stageHeight;
			 setTimeout(startAnimation, inc *4 + 100, inc, rect.x, rect.y);
			 inc++;
		}
	}
	trace("copyPixels",getTimer()-startTime,"ms");
	addEventListener(Event.ENTER_FRAME, onLoop);
}
function startAnimation(index:int, dx:Number, dy:Number):void{
	var interval:Number;
	var animate:Function = function(index:int):void{
		locX[index] += (dx - locX[index]) / 4;
		locY[index] += (dy - locY[index]) / 4;
		if (Math.abs(locX[index] - dx) <1 &#038;&#038; Math.abs(locY[index] - dy)<1){
			locX[index] = dx;
			locY[index] = dy;
			clearInterval(interval);
		}
	}
   interval = setInterval(animate, 32, index);
}
var canvas:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,false, 0xFFFFFF);
addChild(new Bitmap(canvas));
var loc:Point = new Point();

function onLoop(evt:Event):void {
	  canvas.fillRect(canvas.rect, 0xFFFFFF);
	  var startTime:Number = getTimer();
	  for (var i:int = 0; i<tiles.length; i++){
			var tile:BitmapData= tiles[i];
			loc.x = locX[i];
			loc.y = locY[i];
			canvas.copyPixels(tile, tile.rect, loc, null, null, true);
	  }
	  trace("copyPixels",getTimer()-startTime,"ms");
}
</pre>
<p>in my machine (mbp, osx) it takes <strong>~27</strong> ms to extract data and ~2-3ms each iteration for setting data on the canvas bitmapData</p>
<p>Second strike: getVector\<strong>setVector</strong></p>
<pre lang="actionscript">
[SWF(width=650, height=650)]
var loader:Loader = new Loader();
loader.load(new URLRequest("http://actionsnippet.com/wp-content/chair.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
var w:Number;
var h:Number;
var rows:Number = 20;
var cols:Number = 20;
var tiles:Vector.<Vector.<uint>> = new Vector.<Vector.<uint>>();
var tileRect:Rectangle;
var locX:Vector.<Number> = new Vector.<Number>();
var locY:Vector.<Number> = new Vector.<Number>();
var rX:Vector.<Number> = new Vector.<Number>();
var rY:Vector.<Number> = new Vector.<Number>();
var sX:Vector.<Number> = new Vector.<Number>();
var sY:Vector.<Number> = new Vector.<Number>();
function onLoaded(evt:Event):void{
	w = evt.target.width;
	h = evt.target.height;
	var image:BitmapData = Bitmap(evt.target.content).bitmapData;
	var tileWidth:Number = w / cols;
	var tileHeight:Number = h / rows;
	tileRect = new Rectangle(0,0,tileWidth,tileHeight);
	var inc:int = 0;
	var pnt:Point = new Point();
	var rect:Rectangle = new Rectangle(0,0,tileWidth,tileHeight);
	var startTime:Number = getTimer();
	for (var i:int = 0; i<rows; i++){
		for (var j:int = 0; j
<cols; j ++){
			 rect.x = j * tileWidth;
			 rect.y = i * tileHeight;
			 tiles[tiles.length] = image.getVector(rect);
			 rect.x += 25;
			 rect.y += 25;
			 sX[inc] = rect.x;
			 sY[inc] = rect.y;
			 locX[inc] = rX[inc] = -rect.width * 2
			 locY[inc] = rY[inc] =  Math.random() * stage.stageHeight;
			 setTimeout(startAnimation, inc *4 + 100, inc, rect.x, rect.y);
			 inc++;
		}
	}
	trace("vector push:",getTimer()-startTime,"ms");
	addEventListener(Event.ENTER_FRAME, onLoop);
}
function startAnimation(index:int, dx:Number, dy:Number):void{
	var interval:Number;
	var animate:Function = function(index:int):void{
		locX[index] += (dx - locX[index]) / 4;
		locY[index] += (dy - locY[index]) / 4;
		if (Math.abs(locX[index] - dx) <1 &#038;&#038; Math.abs(locY[index] - dy)<1){
			locX[index] = dx;
			locY[index] = dy;
			clearInterval(interval);
		}
	}
   interval = setInterval(animate, 32, index);
}
var canvas:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,false, 0xFFFFFF);
addChild(new Bitmap(canvas));
var loc:Point = new Point();

function onLoop(evt:Event):void {
	  canvas.fillRect(canvas.rect, 0xFFFFFF);
	  var tmpVec:Vector.<uint>;
	  var startTime:Number = getTimer();
	  for (var i:int = 0; i<tiles.length; i++){
		  	tmpVec = tiles[i];
			tileRect.x = locX[i];
			tileRect.y = locY[i];
			canvas.setVector(tileRect,tmpVec);
	  }
	  trace("vector push:",getTimer()-startTime,"ms");
}
</pre>
<p>on my machine it takes only <strong>~9</strong> ms to extract tiles slices (yes, 3 times faster!!!) and ~1ms for pushing them all in the canvas for each loop iteration</p>
<p>Third strike: <strong>getPixels\setPixels</strong></p>
<pre lang="actionscript">
[SWF(width=650, height=650)]
var loader:Loader = new Loader();
loader.load(new URLRequest("http://actionsnippet.com/wp-content/chair.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
var w:Number;
var h:Number;
var rows:Number = 20;
var cols:Number = 20;
var tiles:Vector.<ByteArray> = new Vector.<ByteArray>();
var tileRect:Rectangle;
var locX:Vector.<Number> = new Vector.<Number>();
var locY:Vector.<Number> = new Vector.<Number>();
var rX:Vector.<Number> = new Vector.<Number>();
var rY:Vector.<Number> = new Vector.<Number>();
var sX:Vector.<Number> = new Vector.<Number>();
var sY:Vector.<Number> = new Vector.<Number>();
function onLoaded(evt:Event):void{
	w = evt.target.width;
	h = evt.target.height;
	var image:BitmapData = Bitmap(evt.target.content).bitmapData;
	var tileWidth:Number = w / cols;
	var tileHeight:Number = h / rows;
	tileRect = new Rectangle(0,0,tileWidth,tileHeight);
	var inc:int = 0;
	var pnt:Point = new Point();
	var rect:Rectangle = new Rectangle(0,0,tileWidth,tileHeight);
	var startTime:Number = getTimer();
	for (var i:int = 0; i<rows; i++){
		for (var j:int = 0; j
<cols; j ++){
			 rect.x = j * tileWidth;
			 rect.y = i * tileHeight;
			 tiles[tiles.length] = image.getPixels(rect);
			 rect.x += 25;
			 rect.y += 25;
			 sX[inc] = rect.x;
			 sY[inc] = rect.y;
			 locX[inc] = rX[inc] = -rect.width * 2
			 locY[inc] = rY[inc] =  Math.random() * stage.stageHeight;
			 setTimeout(startAnimation, inc *4 + 100, inc, rect.x, rect.y);
			 inc++;
		}
	}
	trace("getPixels",getTimer()-startTime,"ms");
	addEventListener(Event.ENTER_FRAME, onLoop);
}
function startAnimation(index:int, dx:Number, dy:Number):void{
	var interval:Number;
	var animate:Function = function(index:int):void{
		locX[index] += (dx - locX[index]) / 4;
		locY[index] += (dy - locY[index]) / 4;
		if (Math.abs(locX[index] - dx) <1 &#038;&#038; Math.abs(locY[index] - dy)<1){
			locX[index] = dx;
			locY[index] = dy;
			clearInterval(interval);
		}
	}
   interval = setInterval(animate, 32, index);
}
var canvas:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,false, 0xFFFFFF);
addChild(new Bitmap(canvas));
var loc:Point = new Point();

function onLoop(evt:Event):void {
	  canvas.fillRect(canvas.rect, 0xFFFFFF);
	  var startTime:Number = getTimer();
	  for (var i:int = 0; i<tiles.length; i++){
			tileRect.x = locX[i];
			tileRect.y = locY[i];
			canvas.setPixels(tileRect,tiles[i]);
			tiles[i].position = 0;
	  }
	  trace("setPixels",getTimer()-startTime,"ms");
}
</pre>
<p>a nice one, <strong>~ 17</strong> ms to extract and ~2ms to loop on my mac, faster than copyPixels but vectors are still leading...</p>
<p>Fourth strike: <strong>merge</strong></p>
<pre lang="actionscript">
[SWF(width=650, height=650)]
var loader:Loader = new Loader();
loader.load(new URLRequest("http://actionsnippet.com/wp-content/chair.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
var w:Number;
var h:Number;
var rows:Number = 20;
var cols:Number = 20;
var tiles:Vector.<BitmapData> = new Vector.<BitmapData>();
var locX:Vector.<Number> = new Vector.<Number>();
var locY:Vector.<Number> = new Vector.<Number>();
var rX:Vector.<Number> = new Vector.<Number>();
var rY:Vector.<Number> = new Vector.<Number>();
var sX:Vector.<Number> = new Vector.<Number>();
var sY:Vector.<Number> = new Vector.<Number>();
function onLoaded(evt:Event):void{
	w = evt.target.width;
	h = evt.target.height;
	var image:BitmapData = Bitmap(evt.target.content).bitmapData;
	var tileWidth:Number = w / cols;
	var tileHeight:Number = h / rows;
	var inc:int = 0;
	var pnt:Point = new Point();
	var rect:Rectangle = new Rectangle(0,0,tileWidth,tileHeight);
	var startTime:Number = getTimer();
	for (var i:int = 0; i<rows; i++){
		for (var j:int = 0; j
<cols; j ++){
			 var currTile:BitmapData= new BitmapData(tileWidth, tileHeight, true, 0x00000000);
			 rect.x = j * tileWidth;
			 rect.y = i * tileHeight;
			 currTile.merge(image,rect,pnt,0xFF,0xFF,0xFF,0xFF);
			 tiles[inc] = currTile;
			 rect.x += 25;
			 rect.y += 25;
			 sX[inc] = rect.x;
			 sY[inc] = rect.y;
			 locX[inc] = rX[inc] = -rect.width * 2
			 locY[inc] = rY[inc] =  Math.random() * stage.stageHeight;
			 setTimeout(startAnimation, inc *4 + 100, inc, rect.x, rect.y);
			 inc++;
		}
	}
	trace("merge",getTimer()-startTime,"ms");
	addEventListener(Event.ENTER_FRAME, onLoop);
}
function startAnimation(index:int, dx:Number, dy:Number):void{
	var interval:Number;
	var animate:Function = function(index:int):void{
		locX[index] += (dx - locX[index]) / 4;
		locY[index] += (dy - locY[index]) / 4;
		if (Math.abs(locX[index] - dx) <1 &#038;&#038; Math.abs(locY[index] - dy)<1){
			locX[index] = dx;
			locY[index] = dy;
			clearInterval(interval);
		}
	}
   interval = setInterval(animate, 32, index);
}
var canvas:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,false, 0xFFFFFF);
addChild(new Bitmap(canvas));
var loc:Point = new Point();

function onLoop(evt:Event):void {
	  canvas.fillRect(canvas.rect, 0xFFFFFF);
	  var startTime:Number = getTimer();
	  for (var i:int = 0; i<tiles.length; i++){
			var tile:BitmapData= tiles[i];
			loc.x = locX[i];
			loc.y = locY[i];
			canvas.merge(tile, tile.rect, loc, 0xFF,0xFF,0xFF,0xFF);
	  }
	  trace("merge",getTimer()-startTime,"ms");
}
</pre>
<p><strong>~36</strong> ms to extract and ~12ms to merge tiles on the canvas!!!...too slow all the way...:\</p>
<p>There are still some methods left such as getPixel\setPixel, getPixel32\setPixel32, and copyChannel but they're a too much restrictive choice because they're handling one pixel, or channel at time therefore a further loop would be required to get them doing this task.</p>
<p>Summary:<br />
getVector\setVector : ~9ms\~1ms<br />
getPixels\setPixels: ~17ms\~2ms<br />
copyPixels: ~27ms\~2-3ms<br />
merge: ~36ms\~12ms</p>
<p>make your choice <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>NOTE: these benchmarks are valid from flash player 10 because we (both me and <a href="http://actionsnippet.com/?page_id=3">Zevan</a>) used the Vector native type to store lists of typed data. To make them valid for previous version of the player make sure to replace vectors with arrays and check other types are already supported by the target player.</p>
<p>stay tuned <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/07/15/bitmapdata-manipulation-benchmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My entry to Bit-101s 25 Lines competition</title>
		<link>http://www.flashfuck.it/2008/11/30/my-entry-to-bit-101s-25-lines-competition/</link>
		<comments>http://www.flashfuck.it/2008/11/30/my-entry-to-bit-101s-25-lines-competition/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 13:45:08 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[25lines]]></category>
		<category><![CDATA[contest]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=101</guid>
		<description><![CDATA[Yep, i made my submission to 25lines contest just few days ago (right in time ), so (as Sakri did some days before me) I&#8217;m publishing my code. It&#8217;s an easy terrain generator&#8230; Actually, I think it can be somehow improved both in lines of code and actual performances, so feel free to edit or [...]]]></description>
			<content:encoded><![CDATA[<p>Yep, i made my submission to <a href="http://www.25lines.com/" target="_blank">25lines contest</a> just few days ago (right in time <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ), so (as <a href="http://www.sakri.net/blog/2008/11/19/my-entry-to-bit-101s-25-lines-competition/" target="_blank">Sakri did some days before me</a>) I&#8217;m publishing my code. It&#8217;s an easy terrain generator&#8230;</p>
<p><a href="http://www.flashfuck.it/wp-content/uploads/2008/11/25lines.jpg"></a></p>
<p style="text-align: center;"><a href="http://www.flashfuck.it/wp-content/uploads/2008/11/25linesbmpoptimized.swf" target="_blank"><img class="alignnone size-medium wp-image-102 aligncenter" title="25lines" src="http://www.flashfuck.it/wp-content/uploads/2008/11/25lines-300x300.jpg" alt="" width="300" height="300" /></a></p>
<p>Actually, I think it can be somehow improved both in lines of code and actual performances, so feel free to edit or tell me &#8220;you&#8217;d better to do that this other way&#8230;&#8221; <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What&#8217;s going on is:</p>
<ul>
<li>generate a shape filled with a gradient to create a reference color for differents &#8220;height&#8221;</li>
<li>generate a perlinNoise everyframe for dataprovider use</li>
<li>detect each perlinNoise pixel depth according with its main channel value (blue in this case..)</li>
<li>generating a vector of Bitmaps to be employed in the view</li>
</ul>
<pre lang="actionscript">/**
 * 25-Line ActionScript Contest Entry
 *
 * Project: Random Terrain 3D Generator
 * Author:  Piergiorgio Niero (aka pigiuz) piergiorgio.niero[at]gmail.com
 * Date:    11/24/08
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

// 3 free lines! Alter the parameters of the following lines or remove them.
// Do not substitute other code for the three lines in this section
[SWF(width=800, height=800, backgroundColor=0xffffff, frameRate=24)]
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
// 25 lines begins here!
var _bd:BitmapData = new BitmapData(50,50,false,0x0000FF);
var _points:Array = new Array(new Point());
var _vxCont:Sprite = Sprite(addChild(new Sprite));
_vxCont.x = _vxCont.y = 400;
var _vexels:Vector. = new Vector.((2500),true);
var _hMap:BitmapData = new BitmapData(255,1,false);
var _gradient:Shape = new Shape();
_gradient.graphics.beginGradientFill( GradientType.LINEAR,new Array( 0x4267F9, 0xF9EAB0, 0x9EF07D, 0x8DF273, 0x9D5E1E, 0xFFFFFF ),new Array( 1, 1, 1, 1, 1, 1 ),new Array( 90, 105, 110, 120, 145, 185 ),new Matrix(0.2456396484375,0,0,0.0006103524625,127.5,.5));
_gradient.graphics.drawRect(0,0,255,1);
_hMap.draw(_gradient);
addEventListener(Event.ENTER_FRAME,generatePerlinNoise);
function generatePerlinNoise(e:Event=null):void{
	_bd.perlinNoise(25,25,1,0,false,true,4,false,_points);
	Point(_points[0]).y+=1;
	for(var v:uint=0;v&amp;lt;(2500);v++){
		_vexels[v] = (_vexels[v]==null)?generateVoxel(v):_vexels[v];
		_vexels[v].y = Math.pow((_bd.getPixel(v%50,Math.floor((v/50))) &amp; 0xFF)/255*6,3)*24*.24;
		_vxCont.rotationX = mouseY*.1;
		_vxCont.rotationY = (_vxCont.rotationY-(90/stage.stageWidth*(mouseX-stage.stageWidth)+45))*.5;
		_vexels[v].bitmapData.floodFill(0,0,_hMap.getPixel(255-(_bd.getPixel(v%50,Math.floor((v/50))) &amp; 0xFF),0));}}
function generateVoxel(v:uint):Bitmap{
	var b:Bitmap = new Bitmap(new BitmapData(24*.5,24*.5,false,0x000000),"auto",false);
	b.x = v%50*24-(_bd.width*24*.5);
	b.z = Math.floor((v/50))*24-(_bd.height*24*.5);
	return Bitmap(_vxCont.addChild(b));}
// 25 lines ends here!

enjoy <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2008/11/30/my-entry-to-bit-101s-25-lines-competition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Stratus on Adobe Labs</title>
		<link>http://www.flashfuck.it/2008/11/19/adobe-stratus-on-adobe-labs/</link>
		<comments>http://www.flashfuck.it/2008/11/19/adobe-stratus-on-adobe-labs/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 09:36:01 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Adobe]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=99</guid>
		<description><![CDATA[Did you remember &#8220;Pacifica&#8221; project? Now it&#8217; [UPDATE: Adobe Stratus is a rendezvous service for RTMFP, a new protocol built in to Flash Player 10 and AIR 1.5. Neither RTMFP nor Stratus are related to the project codenamed Pacifica.] Something new is on adobe labs and its name is &#8220;Stratus&#8220;..WONDERFUL! Let&#8217;s explain what i&#8217;m talking [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: line-through;">Did you remember &#8220;<a href="http://blogs.adobe.com/pacifica/">Pacifica</a>&#8221; project? Now </span><span style="text-decoration: line-through;">it&#8217;</span> [UPDATE: Adobe Stratus is a rendezvous service for RTMFP, a new protocol built in to Flash Player 10 and AIR 1.5. Neither RTMFP nor Stratus are related to the project codenamed Pacifica.] Something new is on adobe labs and its name is &#8220;<a href="http://labs.adobe.com/wiki/index.php/Stratus">Stratus</a>&#8220;..WONDERFUL! <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://www.flashfuck.it/wp-content/uploads/2008/11/stratus_sample_app.png"><img class="alignnone size-full wp-image-100" title="stratus_sample_app" src="http://www.flashfuck.it/wp-content/uploads/2008/11/stratus_sample_app.png" alt="" width="456" height="558" /></a></p>
<p>Let&#8217;s explain what i&#8217;m talking about:</p>
<p><a href="http://labs.adobe.com/wiki/index.php/Stratus">Stratus</a> is &#8220;hosted rendezvous service that aids establishing communications between Flash Player endpoints&#8221;.<br />
This technology enables clients&#8217; flash player (10 +, or AIR 1.5) to connect directly each other to share runtime informations&#8230;actually <a href="http://en.wikipedia.org/wiki/Peer-to-peer">PEER TO PEER</a>!! (underline this: Stratus is a service by Adobe, not a technology to run on own servers).</p>
<p>Stratus does support only &#8220;end to end&#8221; p2p, multicast or swarming are not supported. This means we&#8217;re not enabled to create a new air-mule service over stratus, but we can build our p2p video chat, p2p real time games, etc&#8230;</p>
<p>Stratus introduces a new data transfer protocol: RTMFP, which uses UDP instead of clean RTMP which uses TCP. (note, RTMFP is not <a href="http://www.adobe.com/devnet/flashmediaserver/articles/overview_streaming_fms3_02.html">RTMP*</a>, which is the encrypted protocol for FMS).</p>
<p>Stratus is now beta, and you can test a <a href="http://labs.adobe.com/technologies/stratus/samples/">sample application hosted on the labs Stratus page</a>&#8230;</p>
<p>Stratus is going to be released next year (hopefully &#8220;early&#8221;) &#8230;it seems we&#8217;re going to have real time &#8220;anything&#8221; in few months <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>This could be a new red pill for our webapps,<br />
Stay tuned <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2008/11/19/adobe-stratus-on-adobe-labs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cows in chaos</title>
		<link>http://www.flashfuck.it/2008/10/06/cows-in-chaos/</link>
		<comments>http://www.flashfuck.it/2008/10/06/cows-in-chaos/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 13:18:43 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[Isometry]]></category>
		<category><![CDATA[MMOs]]></category>
		<category><![CDATA[Papervision 3D]]></category>
		<category><![CDATA[PV3D]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=94</guid>
		<description><![CDATA[I&#8217;m digging into MMOs, now testing papervision2 cow model (unfortunately i&#8217;m not a modeler, but i&#8217;m a pretty good thief ) and put it on my testing stage&#8230;here&#8217;s the result&#8230;40 COWS! quite good uh? Let me know how it runs on your machines Stay tuned]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m digging into MMOs, now testing <a href="http://www.papervision2.com">papervision2</a> cow model (unfortunately i&#8217;m not a modeler, but i&#8217;m a pretty good thief <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) and put it on my testing stage&#8230;here&#8217;s the result&#8230;40 COWS! quite good uh? <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.flashfuck.it/test/pv3d_isometry_02" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3230/2918740228_b3c8f49e00.jpg?v=0" alt="cows! :D" /></a></p>
<p>Let me know how it runs on your machines <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Stay tuned <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2008/10/06/cows-in-chaos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MMO Test with Papervision3D + Flash Player 10</title>
		<link>http://www.flashfuck.it/2008/10/03/mmo-test-with-papervision3d-flash-player-10/</link>
		<comments>http://www.flashfuck.it/2008/10/03/mmo-test-with-papervision3d-flash-player-10/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 20:53:55 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[Isometry]]></category>
		<category><![CDATA[MMOs]]></category>
		<category><![CDATA[Papervision 3D]]></category>
		<category><![CDATA[PV3D]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=91</guid>
		<description><![CDATA[Here is my very first test on MMOs with Papervision3D on Flash Player 10 (needed to watch properly). here&#8217;s the link http://www.flashfuck.it/test/pv3d_isometry_01/ this is just the beginning&#8230;it has to be tuned and refined but, yes, it can be done PS: I stolen the model somewhere on the web&#8230;please if it is yours don&#8217;t offend yourself, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my very first test on MMOs with Papervision3D on Flash Player 10 (needed to watch properly).</p>
<p style="text-align: center;"><a title="pv3d_isometric_01" href="http://www.flashfuck.it/test/pv3d_isometry_01/"><img class="aligncenter" src="http://farm4.static.flickr.com/3190/2910715764_4d45e7ef03_m.jpg" alt="pv3d_isometric_01" /></a></p>
<p>here&#8217;s the link http://www.flashfuck.it/test/pv3d_isometry_01/</p>
<p>this is just the beginning&#8230;it has to be tuned and refined but, yes, it can be done <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>PS: I stolen the model somewhere on the web&#8230;please if it is yours don&#8217;t offend yourself, i stole it because it&#8217;s good <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  (anyway let me know so i can put your name somewhere <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2008/10/03/mmo-test-with-papervision3d-flash-player-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

