Weblog


Flex And Flash
What is Flex? Flex is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems.


Reordering children using the display list API

This basic example covers a few important concepts. First, the initial layout contains

six buttons within a Tile container, each labeled according to its order within the

Tile. A button at the bottom is used to call a function to move the last child to the

beginning of the Tile container. In moveToTheBeginning( ), the index of the last child

is retrieved, which is zero-based. Next, a reference to the last child in the display list is

obtained using getChildAt( ). After the last child index is retrieved, setChildIndex( )

is called and passes a reference to the button instance and a new index.


--------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>

<![CDATA[

private function moveToTheBeginning( ):void

{

// Retrieve the index of the last child, child indices are zero-based

var lastChildIndex:int = tileOfLabels.numChildren - 1;

// Get a reference to the last child

var child:DisplayObject = tileOfLabels.getChildAt(lastChildIndex);

// Change the index of the child

tileOfLabels.setChildIndex(child,0);

}

]]>

</mx:Script>

<mx:Tile id="tileOfLabels">

<mx:HBox backgroundColor="red" width="50" height="50"/>

<mx:HBox backgroundColor="green" width="50" height="50"/>

<mx:HBox backgroundColor="blue" width="50" height="50"/>

<mx:HBox backgroundColor="black" width="50" height="50"/>

</mx:Tile>

<mx:Button label="Move to the beginning" click="moveToTheBeginning( )"/>

</mx:Application>

----------------------------------------------------------------------


POSTED BY Abhilash ,WEB and UI Designer AT 6/16/2008 1:09 AM 0

COMMENTS





» POST A COMMENT  |  DIGG IT


« BACK HOME









MY PROFILE
Name: Abhilash ,WEB and UI Designer
Location: India ,kerala ,cochin ,Aluva ,Kadungalloor
Hi,my name is Abhilash S, I am a web designer and coder from Kerala India. I specialise in web and UI designing ,however my skills set also includes web design and coding/development in standards complient XHTML/HTML, tableless CSS,Adobe Flex . abhilathi[at]gmail[dot]com



certification

RECENT POSTS
Flex sample application with full source code
Create a simple Sliding Menu Bar with Flex and ActionScript
Web Desktop Application Framework
Adobe ConnectNow
Flex Ajax Bridge


Search All about Adobe Flex





Technorati Profile
Add to Technorati Favorites