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"]);
}
}
}
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.