October 11, 2008
June 23, 2008
Bitmapdata example larger than 2880 px.
Here is a simple example if bitmapdata larger than 2880 px. This is response of my earlier post.
How to use this code…
1. Create an empty folder say bmpTest.
2. Create another folder named imgs inside bmpTest and put tileImg.jpg and canvas.jpg into it.
3. Create an FLA that supports AS3 and create a scrollpane onto the stage. Name it scrPane. Make sure
that dimension of fla would be 800×600 and scrollpane would be 750×530.
4. Create an AS3 class named Main and paste the code below.
////////////////////Code/////////////////////////////
package
{
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.Bitmap;
import flash.geom.Matrix;
import flash.events.*;
public class Main extends MovieClip
{
private var bmpCanvas:BitmapData;
private var bmpTile:BitmapData;
//Constructor
function Main()
{
initialize();
}
private function initialize():void
{
loadTile();
loadCanvas();
}
//Load tile image…
private function loadTile():void
{
var ldrTile:Loader = new Loader();
ldrTile.contentLoaderInfo.addEventListener(Event.COMPLETE, clbTileLoadComplete);
var urlTile:String = “imgs/tileImg.jpg”;
var urlReqTile:URLRequest = new URLRequest(urlTile);
ldrTile.load(urlReqTile);
}
private function clbTileLoadComplete(event:Event):void
{
var tmpBmpTile:Bitmap = event.target.content as Bitmap;
//Store as bitmapdata.
bmpTile = tmpBmpTile.bitmapData.clone();
}
//Load canvas white image
private function loadCanvas():void
{
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, clbCanvasComplete);
var url:String = “imgs/canvas.jpg”;
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
}
private function clbCanvasComplete(event:Event):void
{
var tmpBmp:Bitmap = event.target.content as Bitmap;
//Store as bitmapdata
bmpCanvas = tmpBmp.bitmapData.clone();
showTiledImgInPane();
}
private function showTiledImgInPane():void
{
var bmpPane:Bitmap = new Bitmap(bmpCanvas);
//Create tile.
makeTile();
//Show in pane.
scrPane.source = bmpPane;
scrPane.refreshPane();
}
//Tile image. Keep in mind that the tiled images’ dimension is more than the canvas. I simply mean to say that Tiles will cover complete canvas
//of dimension 3357×3000 px.
private function makeTile():void
{
var wd:uint = bmpTile.width;
var ht:uint = bmpTile.height;
var nTopMargin:Number = 30;
var nLeftMargin:Number = 30;
var nVPitch:Number = 5;
var nHPitch:Number = 5;
for(var i:Number = 0; i < 12; i++)
{
for(var j:Number = 0; j < 10; j++)
{
var mat:Matrix = new Matrix();
var nX:Number = (i * wd) + nLeftMargin;
var nY:Number = (j * ht) + nTopMargin;
if (j != 0)
{
nY = nY + (nVPitch * j);
}
if(i != 0)
{
nX = nX + (nHPitch * i);
}
mat.translate(nX, nY);
bmpCanvas.draw(bmpTile, mat);
mat = null;
nX = 0;
nY = 0;
}
}
}
}
}
////////////////END CODE////////////////////////////
Thanks.
June 2, 2008
Terrorist nature
See this http://feeds.qzone.qq.com/cgi-bin/cgi_rss_out?uin=543809431. Barbarity of mother nature.
May 30, 2008
Bitmapdata larger than 2880 pixel
The width and height parameters specify the size of the bitmap; the maximum value of both is 2880 pixels. Then how to create bitmapdata larger than the maximum specified size?
There are some tricks to snap a bitmap greater than 2880 pixels. One of the trick is this…
1. Load an empty white or black image of desired pixel size [say it would be around 3000x3000 pixels]
2. Clone its bitmapdata.
var bmpDtaClone:BitmapData = bmp.bitmapData.clone();
3. Now you free to draw anything on this bitmap data and flash would have no objection on it.
bmp.floodFill(0, 0, 0xFFFFFFFF);
bmpDtaClone.draw(this, this.transform.matrix, null, null, null, true);
Caution: Dont forget to dispose the bitmapdata as bitmapdata does not dispose itself. It could choke the memory tunnels.
Try this!
May 29, 2008
Codename Astro and pixel blender
Yesterday I was wandering for astro (flashplayer 10). In the meantime, I got another ineteresting tool called ‘Adobe Pixel Blender‘ [This is the toolkit from where you can create custom filters for flash and use it]. Well, I am talking about deadly combination of Flashplayer 10 and Adobe Pixel Blender. I am talking about declared cold war of Adobe Flash Platform against Microsoft silverlight.
We want reservation
These days reservation rocks India. But obviously the demand is absolutely right. In fact government has to provide reservation to each and every religion, caste, state, region etc. and since rest will be obviously in minority so they should too. Thats why I thought that we should also protest for reservation.
– Programmers must be in SC quota [Superior].
– All managers should be dragged into general quota [Bad man].
– Designer can be ST [Friends].
– QA team !@#$% [Pending issue].
Well need your precious comments and after that we will provide a signatured ‘GYAPAN PATRA’ to the government so that could start our f@#$%^g protest.
WE WANT RESERVATION.
[This is personal opinion and not intention to hurt any personal or social feelings.]

