Simple actionscript 3.0 dynamic registration point

this is a very simple dynamic registration point in actionscript 3.0 using fl.motion.MatrixTransformer class. please refer the class for more useful features.

import fl.motion.MatrixTransformer;
import flash.display.Sprite
var box:Sprite;
box = new Sprite();
box.graphics.beginFill(0xFF0000);
box.graphics.drawRoundRect(0, 0, 100, 100, 5);
addChild(box);
box.x = (stage.stageWidth / 2);
box.y=stage.stageHeight/2;
var xPoint:uint =  (box.width/2);
var yPoint:uint =  (box.height / 2);
var mtrx:Matrix=box.transform.matrix;
MatrixTransformer.rotateAroundInternalPoint(mtrx, xPoint, yPoint, 40);
MatrixTransformer.setScaleX(mtrx,2)
box.transform.matrix=mtrx;

actionscript 3.0 Loading image-swf from local file system

This is an example how to load a image file from local hdd to swf file running in a browser.

//file referance
var refer:FileReference=new FileReference();
//file filter
var imagesFilter:FileFilter=new FileFilter("Images","*.jpg;*.gif;*.png");
//loader
var loader:Loader=new Loader();
//event listener for file selection event
refer.addEventListener(Event.SELECT, selectHandler);
// event listener for load complete
refer.addEventListener(Event.COMPLETE, done);

function selectHandler(e:Event):void {
 // load the file after file selection
 refer.load();

}
function done(e:Event) {
 //load the byte array  from the loaded data
 loader.loadBytes(refer.data);
 //add the loader to stage
 addChild(loader);
 //loadevent handler for loader
 loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageDone);
 
}
//button clickevent listener
btn1.addEventListener(MouseEvent.CLICK,loadImage)
function loadImage(e:Event){
 //show the browser window after click the button
 refer.browse([imagesFilter]);
}

function onImageDone(e:Event){
 //resize the image after it add to stage
 loader.width=200;
 loader.height=200;
}

sample source file will be uploaded soon.


PHP developer Cochin |PHP developer Kerala | PHP developer India | Flash developer/programmer Cochin | Flash developer/programmer Kerala | Flash developer/programmer India | web programmer kerala |web programmer Cochin |web programmer India |web developer kerala |Web developer Cochin | Kerala PHP | PHP freelancer| flash actionscript freelancer