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
How to set depth index in action script
var aindex = getChildIndex(a);
var bindex = getChildIndex(b);
var cindex = getChildIndex(c);
trace(aindex);
trace(bindex);
trace(cindex);
xx.addEventListener(MouseEvent.CLICK, clickScrollerItem);
function clickScrollerItem(e:MouseEvent):void
{
//setChildIndex( bindex, 0);
if (a > b)
{
setChildIndex(a,b.numChildren);
}
if (a < b)
{
setChildIndex(a,b.numChildren-1);
}
trace(aindex);
trace(bindex);
trace(cindex);
}
1. Create a movieclips with the instance names a,b,c,d.
Arrange as per the Fig below and press Ctrl+Enter to check output :
0
1
2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment