ТиДжей уже понял это правильно. Просто опубликуйте последний пример на тот случай, если кто-то получит такую же проблему:
TestApplication.mxml
<s:TabbedMobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="init()">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function init():void{
nav1.activeView.addEventListener(CustomEvent.DATA, onData);
nav2.activeView.addEventListener(CustomEvent.DATA, onData);
}
private function onData(ev:CustomEvent):void{
nav1.activeView.data = ev.data;
nav2.activeView.data = ev.data;
}
]]>
</fx:Script>
<s:ViewNavigator id="nav1" label="Nav1" firstView="views.Nav1Home" width="100%" height="100%"/>
<s:ViewNavigator id="nav2" label="Nav2" firstView="views.Nav2Home" width="100%" height="100%"/>
CustomEvent.as
package
{
import flash.events.Event;
public class CustomEvent extends Event
{
public static var DATA:String = "DATA_EVENT";
public var data:Object = null;
public function CustomEvent(data:Object, type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
this.data = data;
}
}
}
views.Nav1Home.mxml
<?xml version="1.0" encoding="utf-8"?>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function init(): void {
this.addEventListener(FlexEvent.REMOVING, removedHandler);
}
private function removedHandler(event:Event):void {
trace("Removed from stage: " + data);
this.dispatchEvent(new CustomEvent("Data from Nav1 Event", CustomEvent.DATA));
}
]]>
</fx:Script>
views.Nav2Home.mxml
<?xml version="1.0" encoding="utf-8"?>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function init(): void {
this.addEventListener(FlexEvent.REMOVING, removedHandler);
}
private function removedHandler(event:Event):void {
trace("Removed from stage: " + data);
this.dispatchEvent(new CustomEvent("Data from Nav2 Event", CustomEvent.DATA));
}
]]>
</fx:Script>