Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex dispatchEvent和eventListener_Apache Flex_Module_Addeventlistener_Dispatchevent - Fatal编程技术网

Apache flex dispatchEvent和eventListener

Apache flex dispatchEvent和eventListener,apache-flex,module,addeventlistener,dispatchevent,Apache Flex,Module,Addeventlistener,Dispatchevent,菜单-右导航 <fx:Metadata> [Event(name="interval", type="flash.events.Event")] <fx:Metadata> [Bindable] public var sInterval:String; [Bindable] public var sIntervalId:String; protected function intervalSelected(event:Mouse

菜单-右导航

<fx:Metadata>
[Event(name="interval", type="flash.events.Event")]
<fx:Metadata>

[Bindable]
public var sInterval:String;
[Bindable]
public var sIntervalId:String;

protected function intervalSelected(event:MouseEvent):void
        {
            sInterval = intervalMenu.selectedItem.intervals_miles;
            sIntervalId = intervalMenu.selectedItem.interval_id;
            dispatchEvent(new Event("interval"));
        }
应用程序设置

MainApp有两个容器RightNavigation和MainContent

MainContent有一个名为MCInterval的模块

所以我试图将值从RightNavigation发送到McInterval

这是一个桌面应用程序,如果这有什么不同的话

这不起作用,我可以看到它正在调试模式下发送值,但ChangeWatcher或evenListener没有检测到任何东西


谢谢,罗伯特

被选为
intervalSelected()
被叫到了吗?怎么用?什么时候?是的,当我按下菜单上的按钮时。调试应用程序时,我可以看到正在传递的两个值。
sInterval
sIntervalId
可绑定吗?它们必须是。可能与模块设置有关。您是否曾在MCInterval中将
interval
变量设置为除null以外的任何值?
<s:VGroup includeIn="iMenu" width="100%" height="100%" horizontalAlign="center" paddingTop="10">
    <s:List id="intervalMenu" styleName="leftNavContent" creationComplete="miles_handler(event)"
        itemRenderer="renderers.MilesItemRenderer" click="intervalSelected(event)" >
    <s:AsyncListView list="{intervalsResult.lastResult}"/>
    </s:List>
</s:VGroup>
initialize="init()"

import containers.RightNavigation;
import mx.binding.utils.ChangeWatcher;
import flash.events.*;

[Bindable]
public var interval:RightNavigation;

public function init():void
        {   
            //addEventListener("interval", intervalServices);
            ChangeWatcher.watch(interval, "sIntervalId", intervalServices);
        }

protected function intervalServices(e:Event):void
        {
            Alert.show("test");
        }