Flash actionscript 3.0: attach a movieclip from library using AS3.0

attach a movieclip from library using AS3.0

Posted by Sankar.G | Posted in | Posted on 6:05 PM

Below code is used to attach a movie Clip using AS 3.0 from a library
var ax:Number=100;
var but:Array=new Array();
function funm() {
for (var i:Number=0; i < 8; i++) {
but[i] = new obj1();
but[i].name = "s"+i;
addChild(but[i]);
but[i].x=ax;
but[i].y=100;
ax=ax+60;
but[i].addEventListener(MouseEvent.ROLL_OVER,fun);
}
}
function fun(e:Event) {
var cc:Number=(e.target.name.substr(1));
getChildByName("s" + cc).addEventListener(MouseEvent.MOUSE_DOWN,fun1);
getChildByName("s" + cc).addEventListener(MouseEvent.MOUSE_UP,fun2);
}
function fun1(e1:Event) {
var ob = e1.target;
ob.startDrag();
}
function fun2(e2:Event) {
var ob1 = e2.target;
ob1.stopDrag();
}
funm();

Comments (0)