求各位高手指点,我快疯了
时间:2011-05-06
来源:互联网
两个按钮,都侦听CLICK事件,事件每发生一次,就用URLLOADER载入一个外部的URL编码文本文件的数据,并根据数据在hourbar(Sprite)生成一个Hourmark图标,第一个按钮设定为点击10次后,生成10个图标就不再侦听CLICK事件,而由第二个按钮开始侦听,同样是用同一个URLLoader载入另一个文本文件数据,在min15bar(Sprite)生成Min15mark图标,载入40个后就不再侦听。程序编完后,第一个按钮正常,点击10次后就不再载入数据,问题是出在第二个按钮的第一次点击,在生成Min15mark图标的同时,在hourbar的第10个Hourmark图标的相同位置,也生成了一个Hourmark图标,而且是依据第二个文本文件的数据生成的。此后一切就都正常了。我是百思不得其解,脑子快爆了。下边是我编的代码:
updatahour.addEventListener(MouseEvent.CLICK,onupdatahour);
function onupdatahour(e:MouseEvent):void{
if(hourcount>=9){
updatahour.removeEventListener(MouseEvent.CLICK,onupdatahour);
updata15min.addEventListener(MouseEvent.CLICK,onupdata15min);
}
dataloader.addEventListener(Event.COMPLETE,onloaddata);
dataloader.load(url1);
function onloaddata(e:Event):void{
variables=URLVariables(e.target.data);
var obj1:Object=new Object();
obj1.high=variables.high;
obj1.$open=variables.$open;
obj1.$close=variables.$close;
obj1.low=variables.low;
var temp:Hourmark=new Hourmark(obj1.high,obj1.$open,obj1.$close,obj1.low);
hourbar.addChild(temp);
temp.x=-5+hourcount*(temp.width+1);
temp.y=150;
temp.scaleY*=2;
temp.cacheAsBitmap=true;
hourwidth=temp.width;
}
++hourcount;
}
function onupdata15min(e:MouseEvent):void{
if(mincount2>=39){
updata15min.removeEventListener(MouseEvent.CLICK, onupdata15min);
updata5min.addEventListener(MouseEvent.CLICK,onupdata5min);
}
dataloader.load(url3);
dataloader.addEventListener(Event.COMPLETE,onloaddata);
function onloaddata(e:Event):void{
variables=URLVariables(e.target.data);
var obj2:Object=new Object();
obj2.high=variables.high;
obj2.$open=variables.$open;
obj2.$close=variables.$close;
obj2.low=variables.low;
var temp:Min15mark=new Min15mark(obj2.high,obj2.$open,obj2.$close,obj2.low);
temp.x=basex+10+mincount2*(temp.width+10);
temp.y=150;
temp.scaleY*=2;
temp.cacheAsBitmap=true;
min15bar.addChild(temp);
}
mincount2++;
}
[ 本帖最后由 roxyman 于 2011-5-6 14:40 编辑 ]
未命名-2.rar (11.75 KB)
fla.rar (20.75 KB)
updatahour.addEventListener(MouseEvent.CLICK,onupdatahour);
function onupdatahour(e:MouseEvent):void{
if(hourcount>=9){
updatahour.removeEventListener(MouseEvent.CLICK,onupdatahour);
updata15min.addEventListener(MouseEvent.CLICK,onupdata15min);
}
dataloader.addEventListener(Event.COMPLETE,onloaddata);
dataloader.load(url1);
function onloaddata(e:Event):void{
variables=URLVariables(e.target.data);
var obj1:Object=new Object();
obj1.high=variables.high;
obj1.$open=variables.$open;
obj1.$close=variables.$close;
obj1.low=variables.low;
var temp:Hourmark=new Hourmark(obj1.high,obj1.$open,obj1.$close,obj1.low);
hourbar.addChild(temp);
temp.x=-5+hourcount*(temp.width+1);
temp.y=150;
temp.scaleY*=2;
temp.cacheAsBitmap=true;
hourwidth=temp.width;
}
++hourcount;
}
function onupdata15min(e:MouseEvent):void{
if(mincount2>=39){
updata15min.removeEventListener(MouseEvent.CLICK, onupdata15min);
updata5min.addEventListener(MouseEvent.CLICK,onupdata5min);
}
dataloader.load(url3);
dataloader.addEventListener(Event.COMPLETE,onloaddata);
function onloaddata(e:Event):void{
variables=URLVariables(e.target.data);
var obj2:Object=new Object();
obj2.high=variables.high;
obj2.$open=variables.$open;
obj2.$close=variables.$close;
obj2.low=variables.low;
var temp:Min15mark=new Min15mark(obj2.high,obj2.$open,obj2.$close,obj2.low);
temp.x=basex+10+mincount2*(temp.width+10);
temp.y=150;
temp.scaleY*=2;
temp.cacheAsBitmap=true;
min15bar.addChild(temp);
}
mincount2++;
}
[ 本帖最后由 roxyman 于 2011-5-6 14:40 编辑 ]
附件

2011-5-6 14:24, 下载次数: 1
附件FLA文件

2011-5-6 14:40, 下载次数: 1
作者: roxyman 发布时间: 2011-05-06
貼個fla吧。直接給你改好了。
作者: enc0717 发布时间: 2011-05-06
這,好多編譯錯誤啊。我無法看到你說的運行結果和問題。
能不能把編譯錯誤解決了再發一次。
我吃完飯給你改。
能不能把編譯錯誤解決了再發一次。
我吃完飯給你改。
作者: enc0717 发布时间: 2011-05-06
汗!看来我还是半桶水啊,多谢了
作者: roxyman 发布时间: 2011-05-06
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28