Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/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
Flash无法将radiobutton标签与字符串进行比较_Flash_Actionscript 3 - Fatal编程技术网

Flash无法将radiobutton标签与字符串进行比较

Flash无法将radiobutton标签与字符串进行比较,flash,actionscript-3,Flash,Actionscript 3,为什么第一个跟踪打印的不是第二个跟踪,而我在属性面板中将标签设置为“hello” 它对我有用。。。至少使用此代码: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://

为什么第一个跟踪打印的不是第二个跟踪,而我在属性面板中将标签设置为“hello”


它对我有用。。。至少使用此代码:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
    <![CDATA[
        protected function radiobutton1_clickHandler(event:MouseEvent):void{
            trace(event.target.label.toString());
            if (event.target.label.toString() == "hello") {
                trace("comparison works");         
            };  
        }
    ]]>
</fx:Script>
<s:RadioButton label="hello" click="radiobutton1_clickHandler(event)"/>
</s:Application>


错误肯定在其他地方

就我个人而言,我猜标签中意外出现了额外的空间


尝试跟踪(event.target.label.toString().length)如果不是5,那就是你的问题。

哦,是的,我在什么地方弄乱了大写字母。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
    <![CDATA[
        protected function radiobutton1_clickHandler(event:MouseEvent):void{
            trace(event.target.label.toString());
            if (event.target.label.toString() == "hello") {
                trace("comparison works");         
            };  
        }
    ]]>
</fx:Script>
<s:RadioButton label="hello" click="radiobutton1_clickHandler(event)"/>
</s:Application>