闪存/ ACTIONSCRIPT2 - 不能获得组合框"变"触发事件,组合、闪存、事件、QUOT

由网友(要学会坚强!)分享简介:我试图使用ComboBox组件为Flash。我无法改变事件触发。我的code是Adobe网站(下面的链接)的pretty的多少直。这个盒子被填充,但改变值不会产生任何跟踪输出。我究竟做错了什么?谢谢http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimp...

我试图使用ComboBox组件为Flash。我无法改变事件触发。我的code是Adobe网站(下面的链接)的pretty的多少直。这个盒子被填充,但改变值不会产生任何跟踪输出。我究竟做错了什么?谢谢

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00002149.html#3138459

  myCombo.addItem(HI1,了hi5);
myCombo.addItem(H2,hi6);
myCombo.addItem(HI3,hi7);
myCombo.addItem(H4,的Hi8);

VAR形式=新的对象();
form.change =功能(是eventObj){
   跟踪(值改为+ eventObj.target.value);
}

myCombo.addEventListener(变,表);
 

解决方案

我贴你的code到AS2的项目和它的工作如预期的我。没有其他的输出?尝试添加跟踪前后的addEventListener以确保它获取调用。请尝试使用一个名称不是形式为对象等。尝试在调试运行,并设置一个断点,在变化的功能。

I'm trying to use the combobox component for Flash. I can't get the change event to fire. My code is pretty much straight of of the adobe site (link below). The box gets populated but changing the value produces no trace output. What am I doing wrong? Thanks

Flash MX 2004编程教程 二

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00002149.html#3138459

myCombo.addItem("hi1", "hi5");
myCombo.addItem("h2", "hi6");
myCombo.addItem("hi3", "hi7");
myCombo.addItem("h4", "hi8");

var form = new Object();
form.change = function(eventObj){
   trace("Value changed to " + eventObj.target.value);
}

myCombo.addEventListener("change", form);

解决方案

I pasted your code into an AS2 project and it worked as expected for me. No other output? Try adding a trace before and after the addEventListener to make sure it's getting called. Try using a name other than form for your object. Try running it in debug and set a breakpoint in the change function.

阅读全文

相关推荐

最新文章