Flex ToolBox: PlayButton
I needed a few different size play buttons to show up over an image
and using transparent GIF images resulted in uglyness. So to throw
another component in my tool box I wrote "PlayButton". If you need a
play button to show up on a mouse over this could be a a nice clean
component to throw in there. Configurbility includes background color
& alpha, play button color & alpha as well as fadein/fadeout
effect settings. The "background" and play button are configured
seperatly so you can have a small play button in the center of a very
large masked area if you desire.
private function getPlayButton(target:DisplayObject, buttonWidth:int):PlayButton {
var btn:PlayButton = new PlayButton(true, 0xFFFFFF, 0.45, 0xFF0000, 0.85);
btn.width = target.width;
btn.height = target.height;
btn.playButtonWidth = buttonWidth;
return btn;
}
In my example above I only set the playButtonWidth and not the height because the button by default will scale upon the setting of either width or height. You can turn this off with a simple "btn.scaleButtonOnResize = false".
In this example app I'm making use of my AdvancedImage Component that is also included in the library.
<flash source="/FlexApps/CookBook-PlayButton/PlayButtonExample.swf" width="454"
height="180" quality="high"
scriptAccess="sameDomain" align="center" />
Download the latest version of PlayButton (source code & example)
Interpreters London wrote on 09/18/09 2:09 AM