28Feb

[AS 3] Yahoo! Alert Box Component and Button Component

No comments

A simple demonstration of the Yahoo! alert box component. There is more functionality to this component to act much like a javascript:prompt window, I am just demonstrating a simple method here. You can find the demos over at Yahoo! Developer Network Alertmanager page.

Here is the document class used:

package
{
	import flash.display.Sprite;
	import fl.controls.Button;
	import com.yahoo.astra.fl.managers.AlertManager;
	import fl.events.ComponentEvent;
	import flash.events.MouseEvent;

	// Use of the Yahoo! Alert Manager Component
	public class YahooAlertBox extends Sprite
	{
		private var button:Button;
		private var btnArr:Array;

		public function YahooAlertBox()
		{
			button = new Button();
			button.width = 100;
			button.height = 30;
			button.move ( stage.stageWidth / 2 - button.width / 2, stage.stageHeight / 2 - button.height / 2 );
			button.label = "Open Alert Box";

			addChild(button);

			button.addEventListener(MouseEvent.CLICK, alert);
		}

		//event handler to trigger the alert
		function alert(e:MouseEvent):void
		{
			AlertManager.createAlert(this, "Here is my message", "My Title: Alert Box",["close alert"]);
		}
	}

}

Share/Save/Bookmark

Thursday, February 28th, 2008 at 9:58 am and is filed under Actionscript 3, Yahoo! Components. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply