Fireworks and On Vacation
No comments“See” you all late next week - Have a good holiday! I modified some code from Keith Peter’s book to create the animation, you can check out his book here: Foundation Actionscript 3.0 Animation: Making Things Move!, to create this fireworks animation display.
Google’s Improved Flash Indexing
No commentsThis is of interest to most:
http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html
BitmapData Perlin Noise
No commentsSaw this over at Adobe with the use of the perlinNoise method:
package
{
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;
public class BitmapDataPerlinNoise extends Sprite
{
public function BitmapDataPerlinNoise()
{
var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00ffffff);
var seed:Number = Math.floor(Math.random() * 10);
var channels:uint = BitmapDataChannel.RED | BitmapDataChannel.BLUE | BitmapDataChannel.GREEN;
bmd.perlinNoise(100, 80, 6, seed, false, true, channels, false, null);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);
}
}
}
Filling BitmapData Colors with an alternate color with the floodFill Method
No commentsI wanted to learn more about bitmap data in flash and came across the floodFill() method. It basically will replace a color with one you assign it. In the demo the original color is a light blue (rgb 003366) and when you click the stage the square will change colors via the floodFill method.
package
{
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.events.MouseEvent;
public class FloodFillExample extends Sprite
{
private var _bmd:BitmapData;
private var _rect:Rectangle;
private var _bm:Bitmap;
public function FloodFillExample()
{
_bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00cccccc);
_rect = new Rectangle(0, 0, stage.stageWidth/2, stage.stageHeight/2);
_bmd.fillRect(_rect, 0x00336699);
AddBm();
stage.addEventListener ( MouseEvent.MOUSE_DOWN, Flood );
}
private function Flood( e:MouseEvent )
{
// public function floodFill(x:int, y:int, color:uint):void
_bmd.floodFill(0, 0, Math.random() * 0xffffff);
AddBm();
}
private function AddBm():void
{
var _bm:Bitmap = new Bitmap(_bmd);
addChild(_bm);
}
}
}
Image Gallery - Fix Fullscreen Image Stretching
No commentsSo I noticed that when you view the image gallery in Fullscreen mode the images become stretched to become proportional to you screen dimensions. This is an easy fix and can be done by adding a few lines of code:
this.stage.align = "topLeft"; this.stage.scaleMode = "noScale";
That should do it.