following tutorial help actionscript 3.0 beginners and actionscript 2.0 developers new to actionscript 3.0 to understand how actionscript 3.0 buttons works, how to attach a button to actionscript 3.0 events.
Labels: Actionscript Training
this is a simple example how to create a pure flash based screen share application with flash ide and actionscript 3.0
sample urls
Publisher: http://www.actionscript.co.in/publisher.html
Viewer : http://www.actionscript.co.in/viewer.html
Hope you guys enjoy screen share :)
Labels: ActionScript 3.0, screen share
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;
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.
Labels: ActionScript 3.0
This post is a simple example for actionscript 3.0 beginners. The bellow actionscript 3.0 code help you to understand how you can load an external image from a url. if any doubt or help please add a comment.
import flash.display.Loader;
import flash.net.URLRequest;
var url:String="http://www.sfubiz.ca/misa/image/flash.jpg"
var loader:Loader = new Loader();
loader.load(new URLRequest(url));
addChild(loader);
hi,
this post is not for actionscript masters this is only for those who just started playing with actionscript. this simple example demonstrate how to open a url with querystring HTTP GET method.
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLVariables;
var url:String="http://anilmathewm.blogspot.com/search";
var variables:URLVariables = new URLVariables();
variables.q="actionscript";
var urlRequest:URLRequest = new URLRequest(url);
urlRequest.method="GET";
urlRequest.data=variables;
navigateToURL(urlRequest, "_blank");
bellow is a simple example to change the color of a DisplayObject(MovieClip,Button,Sprite) in flash actionscript 3.0.
// creates a red square
var square:Shape = new Shape();
//fill the square with blue color
square.graphics.beginFill(0x0000FF);
// drow the square
square.graphics.drawRect(0, 0, 150, 150);
//add the square to stage
addChild(square);
// calling the change color function
changeColor(square,0xff0000);
//changeColor function
function changeColor(o:DisplayObject,color:Number):void {
//create a new ColorTransform
var newColor:ColorTransform=new ColorTransform();
// set the color property
newColor.color=color;
//assign the new ColorTransform to target DisplayObject
o.transform.colorTransform=newColor;
}