title: Using preventDefault for a View
body: <p>I've created a simple TabbedViewNavigatorApplication. Two of the tabs are going to send text and email, respectively, rather than load a new View.  So I need to prevent the default behavior of pushing the new View. </p>
  
  <p>Documentation says <a href="http://opensource.adobe.com/wiki/display/flexsdk/View+and+ViewNavigator" rel="nofollow">a view can cancel a navigation operation by canceling its FlexEvent.REMOVING</a>. However, there apparently is no such Constant for <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/events/FlexEvent.html" rel="nofollow">FlexEvent</a>. There is, however, for ViewNavigatorEvent, as described farther down on that first link.  </p>
  
  <p>So here's what I've got, but I neither see the trace statements nor am able to stop the navigation:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
  xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160" creationComplete="completeHandler(event)"&gt;
  &lt;fx:Script&gt;
      &lt;![CDATA[
  
          import mx.events.FlexEvent;
  
          import spark.events.ViewNavigatorEvent;
  
          private function completeHandler(e:Event):void
          {
              vwText.addEventListener(ViewNavigatorEvent.REMOVING, removingHandler);
          }
  
          private function removingHandler(e:ViewNavigatorEvent):void
          {
              trace("removingHandler::");
              e.preventDefault();
          }
  
          private function doSomething(e:MouseEvent):void
          {
              trace("Do Something");
          }
  
      ]]&gt;
  &lt;/fx:Script&gt;
  &lt;s:ViewNavigator  id="vwText" label="Text" width="100%" height="100%" click="doSomething(event)" firstView="views.SendasTextView"/&gt;
  &lt;s:ViewNavigator  label="Email" width="100%" height="100%"  firstView="views.SendasEmailView"/&gt;
  &lt;s:ViewNavigator label="History" width="100%" height="100%" firstView="views.HistoryView"/&gt;
  &lt;fx:Declarations&gt;
      &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
  &lt;/fx:Declarations&gt;
  </code></pre>
  
  <p></p>