This Blog contains About Action script 3.0 Variables, Data types, Access specifies, Keywords, Operators, Conditional statements, Control statements, Arrays (Indexed, Associative, Multidimensional, Cloning), Functions, Symbols, Movie clips (Transformation point, Registration point, Loading images), Buttons, Events (Key board, Mouse, Timer, XML)Pre- defined function :- Random, Hit test object, Drag and drop, Sort, Loader, Tween,URL Loader, Video components, Audio Components, Sound Channel.
Friday, 8 March 2013
create dynamic movieclip, import external images and mouse down listener in as3
Code :-
=====
var mc_clips:Array=[];
var aalage_bigloader:Array=[];
for (var i:Number = 1; i < 3; i++) {
var mc:MovieClip = new MovieClip();
mc.name="alage_big"+i;
mc_clips[i]=mc;
for (var j:Number = 1; j < 3; j++) {
var alage_bigloader = new Loader();
alage_bigloader.name="alage_bigloader"+j;
aalage_bigloader[j]=alage_bigloader;
}
addChild(mc_clips[i]);
aalage_bigloader[1].load(new URLRequest("a.PNG"));
aalage_bigloader[2].load(new URLRequest("b.PNG"));
mc_clips[i].addChild(aalage_bigloader[i]);
}
mc_clips[1].x=13;
mc_clips[1].y=82;
mc_clips[2].x=130;
mc_clips[2].y=100;
mc_clips[1].addEventListener(MouseEvent.MOUSE_DOWN,click_fun);
function click_fun(e:MouseEvent) {
trace("111111111111111111111");
}
mc_clips[2].addEventListener(MouseEvent.MOUSE_DOWN,click2_fun);
function click2_fun(e:MouseEvent) {
trace("2222222222222222222222222");
}
Out put :-
=======
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment