用户名: 密码: 验证码: QQ--程序群:31736530 动画群:38836599
闪无忧
 
首 页 业界新闻 业界杂谈 Flash教程 Flash源码 Flash图书 Flash酷站 Flex & AIR 供求信息
   本栏目通告:   有意向写收费精品教程的朋友,请联系本站合作
当前位置 :首页>flash教程>Fms教程>列表

关于FMS SharedObject 的探讨

[来源:25swf.com | 作者:25swf.com | 时间:2008-04-04 | 点击:  | 收藏本文  【 】]
 在客户端对so进行大量更新时,容易出现so不同步的情况

个人总结原因如下。
1.网络延时问题
2.SharedObject实现机制问题

原本一直以为,Remote SharedObject 是事件驱动的,当SO发生改变量,就会把改变的内容传到服务器,但查了一个帮助文档,发现SO并不是事件驱动的,而是每隔一个时间,update一次更新。

帮助文档中的相关内容

SharedObject.setFps()
Availability
Flash Player 6.
■Flash Communication Server MX 1.0.
Usage
myRemote_so.setFps(updatesPerSecond)
Parameters
updatesPerSecond A number that specifies how often a client’s changes to a remote shared
object are sent to the server. The default value is the frame rate of the SWF file.
■To send changes immediately and then stop sending changes, pass 0 for
updatesPerSecond.
■To reset updatesPerSecond to its default value, pass a value less than 0.
Returns
A Boolean value of true if the update was accepted; otherwise, false.
Description
Method; specifies the number of times per second that a client’s changes to a shared object are
sent to the server.
Use this method when you want to control the amount of traffic between the client and the
server. For example, if the connection between the client and server is relatively slow, you may
want to set updatesPerSecond to a relatively low value. Conversely, if the client is connected
to a multiuser game in which timing is important, you may want to set updatesPerSecond to
a relatively high value.
If you want to manually control when updates are sent, issue this command with
updatesPerSecond set to 0 when you want to send changes to the server. For example, if you
want to let the user push a button that sends updates to the server, attach
myRemoteSharedObject.setFps(0) to the button.
Regardless of the value you pass for updatesPerSecond, changes are not sent to the server
until SharedObject.onSync has returned a value for the previous update. That is, if the
response time from the server is slow, updates may be sent to the server less frequently than
the value specified in updatesPerSecond.

因此,在做大量数据更新时,可能导致不同步的出现。

解决方法有两种,
1 是把大量的要更新的数据放在一个临时的变量中,然后再一次性赋予SO.
2 使用setFps(0) setFps(-1) 来控制SO 的update ,让所有应该一次更新的数据就位后,再更新server 的 SO

文章如果有错误或者缺少文件,请发邮件提交给我们
上一篇:FLV on P2P 下一个流行的video格式
下一篇:FMS在线用户数读取解决
Tags:     探讨 关于 the to value updatesPerSecond you server
>>> 最新评论:(共有 0 位网友发表了评论)      查看所有评论
  发表评论
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
·本站发布内容均为客观表达作者观点,不代表闪无忧立场,请勿攻击和漫骂
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
  教程分类
  基础操作   动画特效
  应用开发   组件学习
  As程序   动画教程
  Flash cs3   AS 3.0
  FCS/FMS教程   Loading教程
  Flash与Web   Flash教程连载
  相关文章
·fms 2.0A星寻路
·FMS音频延迟分析
·fms中介函数
·flv在线视频播放
·FMS在线用户数读取解决
·关于FMS SharedObject 的探讨
·FLV on P2P 下一个流行的video格
·awflasher的Vplayer 2.1 ( FLV P
·gotoAndLearn.com的Flash flv视
·(网游基础)FMS做成的客户端动
  热门文章
·Flash进度条的制作详细讲解(组图)
·flash幻灯片网页效果
·Flash打造简单的飘雪动画视觉特效
·Flash旋转拖尾文字效果的制作教程
·flash水影效果字
·全Flash动画网站实现的基础教学
·超酷flash光晕移动效果
·flash春雷闪电效果
·Flex 3 AdvancedDataGrid的使用(第二
·Flash制作大雪纷飞效果动画
·即拷即用的loading代码
关于我们 - 免责声明 - 网站地图 - 商务服务 - 联系我们 - RSS地图
©CopyRight 2006-2008, 5UFlash.COM, Inc. All Rights Reserved
鲁ICP备06034971号