Creating a Drag and Drop Game In AS3
Take a New File In Flash. Change Stage color to Black in Property pallete
Create a Star shape using polystar tool.
Select the polystar tool> properties >Inside option select Star
Convert the star shape to Movie Clip
Inside movie Clip advance option> Export for action script
Change the name of class to "star"
Write the given script
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
var A:Array = new Array();
for (var i:uint = 0; i < 5 ; i++) {
A[i] = new star();
A[i].x = 540*Math.random();
A[i].y = 400*Math.random();
var s=100*Math.random();
A[i].width=s;
A[i].height=s;
A[i].alpha=Math.random();
var starColor:ColorTransform = new ColorTransform();
starColor.color = (Math.random() * 0xFFFFFF);
A[i].transform.colorTransform=starColor;
addChild(A[i]);
A[i].doubleClickEnabled=true;
A[i].buttonMode=true;
A[i].addEventListener(MouseEvent.CLICK,fundrag);
A[i].addEventListener(MouseEvent.DOUBLE_CLICK,fundrop);
}
function fundrag(e:Event){
e.currentTarget.startDrag();
}
function fundrop(e:Event){
e.currentTarget.stopDrag();
}
Subscribe to:
Posts (Atom)
Things Web Developers Must Include in Their Portfolio
1. Need to have Link and Screen shot of their past projects 2. If they are applying for a specific skill like PHP or ASP.Net. Need to...
-
1. Oberon Color Replacer for CorelDRAW/Corel DESIGNER :- This macro allows you replace one color with another quickly. (free) 2. LimitC...
-
1. Fold Up 3D - to convert package layout to 3d packet. 2. DGI SignSymbols for Adobe Illustrator CSthrough CS6 : - official sign...
-
Trans Slide Show (free extension)- Create image slide shows, either using simple image swaps (all browsers), or optionally with advanced t...