Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.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
Actionscript 3 如何在flash中设置值和触发功能_Actionscript 3_Flash_Flash Builder_Mxml - Fatal编程技术网

Actionscript 3 如何在flash中设置值和触发功能

Actionscript 3 如何在flash中设置值和触发功能,actionscript-3,flash,flash-builder,mxml,Actionscript 3,Flash,Flash Builder,Mxml,大家好,这是我的第一个flash应用程序,我有两个函数,一个是点击处理程序,带您进入列表页面,另一个是调用结果的函数,actionscript中有没有办法通过php($)中的变量传递值 我需要做的是从按下的按钮上关闭函数,每个按钮都需要向列表提供不同的值,以获得结果这两个函数 protected function button_clickHandler_100():void { currentState='data'; } protect

大家好,这是我的第一个flash应用程序,我有两个函数,一个是点击处理程序,带您进入列表页面,另一个是调用结果的函数,actionscript中有没有办法通过php($)中的变量传递值

我需要做的是从按下的按钮上关闭函数,每个按钮都需要向列表提供不同的值,以获得结果这两个函数

        protected function button_clickHandler_100():void
    {
        currentState='data';
    }

    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
    {
        getCitysResult.token = cityservice.getCitys(/* VALUE ENTERED HERE */);
    }

    <s:Button click="button_clickHandler_100()" id="button128" includeIn="europe" skinClass="components.englandButton" x="101" y="135"/>
    <s:Button click="button_clickHandler_100()" id="button129" includeIn="europe" skinClass="components.denmarkButton" x="135" y="117"/>
    <s:Button click="button_clickHandler_100()" id="button130" includeIn="europe" skinClass="components.polandButton" x="214" y="135"/>

    <mx:DataGrid includeIn="data" x="28" y="10" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getCitysResult.lastResult}" width="276" height="255">
    <mx:columns>
        <mx:DataGridColumn headerText="city" dataField="city"/>
    </mx:columns>
    </mx:DataGrid>
受保护的功能按钮\u clickHandler\u 100():无效
{
currentState='data';
}
受保护函数dataGrid_creationCompleteHandler(事件:FlexEvent):无效
{
getCitysResult.token=cityservice.getCitys(/*此处输入的值*/);
}
例如,需要提供的vlaue是按钮128的GB,按钮130的PL

getCitys返回城市列表,并根据2个字母的代码填充数据网格。这是一项php服务


是否有一种方法可以让clickHandler根据按下哪个按钮向GetCity函数提供值按钮id说

是。但我不确定你需要传递什么数据。显示按钮的代码。getCitys做什么?它期望什么样的值?当单击按钮时,您总是可以将当前按钮id存储在类成员中,然后在dataGrid\u creationCompleteHandler方法中访问它。很抱歉,我不太明白您是否可以举例说明您所说的内容,我可能更能理解,但正如我所说的,我的第一个flash应用程序是否尝试在函数调用本身中发送它的id,如
按钮\u clickHandler\u 100(this.id)
。它认为它将帮助您确定哪个按钮分派事件,并且您可以使用简单的条件从中设置您想要的任何值。解决方法是取消创建completehandler,并创建一个新的click hanldler,每个按钮都具有绑定到click handler的每个按钮的不同值