Alright, this example is very similar to the other examples I have done. But with this one I am scaling all pixels at the same rate. Just click on it the image in the example Source | Example
Actionscript:
-
import flash.display.*;
-
import caurina.transitions.Tweener;
-
import flash.sampler.*;
-
-
var pixHolder:Sprite = new Sprite();
-
-
var img:Img = new Img();
-
//pixHolder.opaqueBackground = true;
-
-
addChild(pixHolder);
-
-
-
var coords_array:Array = [];
-
var pixels_array:Array = [];
-
-
var bmd:BitmapData = new BitmapData(img.width, img.height, false);
-
bmd.draw(img, new Matrix());
-
bmd.lock();
-
startSampling();
-
-
-
-
for (var i:int = 0; i <img.width; i++)
-
{
-
for (var j:int = 0; j <img.height; j++)
-
{
-
var coords:Object = {};
-
-
//var pixData:BitmapData = new BitmapData(1, 1, false, bmd.getPixel(i, j));
-
-
//var pixBit:Bitmap = new Bitmap(pixData, PixelSnapping.ALWAYS, true);
-
-
var pixSprite:Sprite = new Sprite();
-
pixSprite.graphics.beginFill(bmd.getPixel(i, j), 1);
-
pixSprite.graphics.drawRect(0, 0, 1, 1);
-
pixSprite.graphics.endFill();
-
-
pixSprite.x = i;
-
pixSprite.y = j;
-
//pixSprite.filters = [new BlurFilter(5, 5, 3)];
-
//pixSprite.addChild(pixBit);
-
pixHolder.addChild(pixSprite);
-
-
coords.sprite = pixSprite;
-
coords.x = i;
-
coords.y = j;
-
coords_array.push(coords);
-
}
-
}
-
trace("what: " +getSampleCount() )
-
-
bmd.unlock();
-
bmd.dispose();
-
stage.addEventListener(MouseEvent.CLICK, updating, false, 0, true);
-
-
-
function updating(evt:MouseEvent):void
-
{
-
removeEventListener(MouseEvent.CLICK, updating);
-
trace("over");
-
-
for(var k:int = 0; k <coords_array.length; k++)
-
{
-
Tweener.addTween(coords_array[k].sprite, {x:coords_array[k].sprite.x * 2, scaleX:coords_array[k].sprite.scaleX * 2, scaleY:coords_array[k].sprite.scaleY * 2, delay:.5, y:coords_array[k].sprite.y * 2, transition:"linear", time:.5});
-
}
-
trace(getSampleCount() )
-
}
Last 5 posts in as3
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to load Pixel Bender in Flash Player 10 - May 19th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v2 - April 23rd, 2008
Last 5 posts in Bitmap/BitmapData
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v2 - April 23rd, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v1 - April 21st, 2008
Last 5 posts in flash
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to load Pixel Bender in Flash Player 10 - May 19th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
- How to use Bitmap and BitmapData in ActionScript 3 - v2 - April 23rd, 2008
Last 5 posts in I just thought
- Happy Birthday, me - June 20th, 2008
- Mrs. Spitzer's thoughts during her husbands sex scandal press conference - March 12th, 2008
- Hilary Clinton's Advice to NY Governor's wife - Bitstrips is awesome - March 12th, 2008
- I heart FOX/NBC Universial hulu - February 27th, 2008
- My thoughts on the writers strike - December 27th, 2007
Last 5 posts in observations
- Mrs. Spitzer's thoughts during her husbands sex scandal press conference - March 12th, 2008
- This is what I don't like about Comedy - February 17th, 2006
- To go or not to go that is the question - January 13th, 2006
- So what's going on - October 8th, 2005
- I see dead people - August 27th, 2005
Josh Weatherspoon, A self-proclaimed millionaire who for some reason has to work as a Flash Developer, at Travelocity in Dallas(Southlake), TX.


Sorry, no comments yet.