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.
Wednesday, 19 December 2012
Drop down list in actionscript3 using transitions effects
//Import the required classes
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
//Turn on buttonMode for our movieclips
button_mc.buttonMode=true;
dropdown_mc.buttonMode=true;
//Add the dropDown Event Listener
button_mc.addEventListener(MouseEvent.CLICK, dropDown);
//initial dropDown function to animate on our dropdown movieclip into the mask
function dropDown(e:MouseEvent):void
{
var enterTween:Tween;
enterTween = new Tween(dropdown_mc, "y", Regular.easeOut, dropdown_mc.y, 177, 30, false);
enterTween.addEventListener(TweenEvent.MOTION_FINISH, dropUpEventListener);
}
//This function is called on after the dropdown animation is finished
function dropUpEventListener(e:TweenEvent):void
{
button_mc.removeEventListener(MouseEvent.CLICK, dropDown); //remove event listener to dropDown function
button_mc.addEventListener(MouseEvent.CLICK, dropUp); // add event listener for dropUp function
}
//Drop up function tweens out our dropdown movieclip from the mask
function dropUp(e:Event):void
{
var enterTween:Tween;
enterTween = new Tween(dropdown_mc, "y", Regular.easeOut, dropdown_mc.y, -8, 30, false);
enterTween.addEventListener(TweenEvent.MOTION_FINISH, dropDownEventListener);
}
//Function does the exact opposite of the dropUpEventListener
function dropDownEventListener(e:TweenEvent):void
{
button_mc.removeEventListener(MouseEvent.CLICK, dropUp);
button_mc.addEventListener(MouseEvent.CLICK, dropDown);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment