I was messing around w/ the Yahoo's Astra Library, mainly the Menu Component and added a little fade on the menu so it's not so harsh when it comes up.
It's easy just use the show/hide events **Remember use the constants**
Actionscript:
-
//import the required data class
-
import com.yahoo.astra.fl.controls.Menu;
-
import com.yahoo.astra.fl.data.XMLDataProvider;
-
import com.yahoo.astra.fl.events.*;
-
import fl.transitions.Tween;
-
import fl.transitions.easing.*;
-
-
//Create some XML to populate the menu don't leave in CDATA
-
var colors:XML =
-
<!--[CDATA[ <root> <menuitem label="Red" iconSource="RedBox"> <menuitem label="Orange" /> <menuitem label="Yellow" /> <menuitem label="Green" /> <menuitem label="Blue" /> </menuitem> <menuitem label="Orange" /> <menuitem label="Yellow" /> <menuitem label="Green" /> <menuitem label="Blue" /> <menuitem label="Purple" /> ]]-->
-
-
//give the menu the xml data above
-
menu.dataProvider = new XMLDataProvider(colors);
-
menu.iconField = "iconSource";
-
//cause the button to display the menu
-
button.addEventListener(MouseEvent.CLICK, showMenu);
-
menu.addEventListener(MenuEvent.MENU_SHOW, showing);
-
menu.addEventListener(MenuEvent.MENU_HIDE, hiding);
-
-
function hiding(evt:MenuEvent):void
-
{
-
menu.addEventListener(MenuEvent.MENU_SHOW, showing);
-
menu.removeEventListener(MenuEvent.MENU_HIDE, hiding);
-
trace("hiding");
-
-
var myTween:Tween = new Tween(Menu(evt.currentTarget), "alpha", Elastic.easeOut, 1, 0, 15, true);
-
}
-
function showing(evt:MenuEvent):void
-
{
-
menu.removeEventListener(MenuEvent.MENU_SHOW, showing);
-
menu.addEventListener(MenuEvent.MENU_HIDE, hiding);
-
-
Menu(evt.currentTarget).alpha = 0;
-
var myTween:Tween = new Tween(Menu(evt.currentTarget), "alpha", Elastic.easeOut, 0, 1, 5, true);
-
}
-
//display the menu
-
function showMenu(event:MouseEvent):void
-
{
-
//display the menu at the bottom of the button
-
menu.show();
-
}
here is the proof example | source
Last 5 posts in components
- Yahoo Maps ActionScript 3.0 Released - February 11th, 2008
- Flash CS3 and the TileList - July 15th, 2007
Last 5 posts in flash
- Flash Player 10 Pure Flash Keyboard using SampleDataEvent - September 3rd, 2008
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
- Flash Player 10 Dynamic Sound Generation - May 20th, 2008
- How to load Pixel Bender in Flash Player 10 - May 19th, 2008
- How to compile and examples for Flash Player 10 or ASTRO BETA - May 16th, 2008
Josh Weatherspoon, A self-proclaimed millionaire who for some reason has to work as a Flash Developer, at Travelocity in Dallas(Southlake), TX.
Sorry, no comments yet.