How to use BlurFilter with flash actionscript

Simple Example to show How to use BlurFilter

example

import flash.display.*;
import flash.filters.*;

var _rectData:BitmapData = new BitmapData(200, 200);

function drawRectangle():void {
	_rectData.fillRect(new Rectangle(40, 0, 150, 150), 0xFF0000FF);

	var rect:Sprite = new Sprite();
	addChild(rect);

	var bitmap:Bitmap = new Bitmap(_rectData);
	rect.addChild(bitmap);
}

function Blur_Filter() {
	drawRectangle();
	var filter:BitmapFilter = getBitmapFilter();
	var myFilters:Array = new Array();
	myFilters.push(filter);
	filters = myFilters;
}

function getBitmapFilter():BitmapFilter {
	var blurX:Number = 60;
	var blurY:Number = 60;
	return new BlurFilter(blurX, blurY, BitmapFilterQuality.HIGH);
}

Blur_Filter();

(more…)

Load Date from XML File using flash actionscript AS3

Simple Example to show how to load xml

package
{
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    public class DocumentClass extends Sprite
    {
        private var loader:URLLoader;
        private var xmlPath:URLRequest;

        public function DocumentClass()
        {
	 xmlPath = new URLRequest("http://server.com/xml.xml")
	loader = new URLLoader(xmlPath);
            loader.addEventListener(Event.COMPLETE, completeListener);
            loader.addEventListener(ProgressEvent.PROGRESS, progressListener);
        }

        private function completeListener(event:Event):void
        {
            trace(" all done loading " + loader.data + " and here's the xml file we loaded ");
        }

        private function progressListener(event:Event):void
        {
            trace(" loading.... " + loader.bytesLoaded + " / " + loader.bytesTotal + " bytes");
        }
    }
}

How to use URLVariables() in Flash AS3?

Using URLVariables in Flash or Flex we can send and receive data from server he is the example

This is the PHP Code nested in the server
Create a PHP file and place it in the server

<?php
 $email=$_POST['email'];
 $password=$_POST['password'];

echo "email=".$_POST['email']."&amp;password=".$password;
?>

Here is the code in Flash/Flex

//create URLRequest instace withe the target URL
var request:URLRequest = new URLRequest("http://www.example.com/data.php");

//create instance of the class
var variables:URLVariables = new URLVariables();

variables.email = druva.flash@gmail.com;
variables.password = 'dontexpectit';

//add the data to the URLRequest
request.data = variables;

//Choose a method as POST
request.method = URLRequestMethod.POST;

var loader:URLLoader = new URLLoader();
//Create EventListener
loader.addEventListener(Event.COMPLETE, handleComplete);

//send the request with URLLoader()
loader.load(request);

 function handleComplete(event:Event)  {
var loader:URLLoader = URLLoader(event.target);
var vars:URLVariables = new URLVariables(loader.data);

//Read data for the result
trace("vars.email: "+vars.email);
trace("vars.password: "+vars.password);
 }

load image class in as3

package {

import flash.display.*;
import flash.net.*;

	public class loadImage extends Sprite {

		public function loadImg() {
			init()
		}

		private function init():void {
			var loader:Loader = new Loader();
			addChild(loader);
			loader.load(new URLRequest("http://server.com/imagepath.ext"));
		}
	}

}