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, 21 December 2012
zoom in, zoom out in as3
var count_zoom:Number = 0;
zoomInButton.addEventListener(MouseEvent.MOUSE_DOWN, zoomIn);
zoomOutButton.addEventListener(MouseEvent.MOUSE_DOWN, zoomOut);
function zoomIn(e:MouseEvent)
{
bg.scaleX += .1;
bg.scaleY += .1;
count_zoom++;
}
function zoomOut(e:MouseEvent)
{
bg.scaleX -= .1;
bg.scaleY -= .1;
count_zoom--;
}
stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event)
{
if (count_zoom == 0)
{
trace("0");
zoomOutButton.visible = false;
}
if (count_zoom == 5)
{
trace("5");
zoomInButton.visible = false;
}
if (count_zoom >= 1 && count_zoom <= 4)
{
trace("1,2,3,4");
zoomInButton.visible = true;
zoomOutButton.visible = true;
}
}
1. Create movieclips instance name of bg, zoomInButton, zoomOutButton
Out put :-
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment