Mega Code Archive
Present user with an option of navigating to the target location or cancelling the action
import flashx.textLayout.events.FlowElementMouseEvent;
import flashx.textLayout.elements.LinkElement;
import mx.controls.Alert;
import mx.events.CloseEvent;
private var linkTarget:String;
private function doSomething(e:FlowElementMouseEvent):void {
e.stopImmediatePropagation();
e.preventDefault();
var le:LinkElement = e.flowElement as LinkElement;
linkTarget = le.href;
Alert.show("You are about to navigate away from this page.","Alert",Alert.OK |Alert.CANCEL, this, alertListener, null, Alert.OK);
}
private function alertListener(e:CloseEvent):void {
if (e.detail == Alert.OK) {
navigateToURL(new URLRequest(linkTarget), '_self')
}
}
The following link takes you to: Adobe.com