您的位置:首页 > 理论基础 > 计算机网络

解决FaustCplus的两个bug

2015-08-06 11:17 686 查看

1、解决因flash版本升级而导致FaustCplus生成不了预览图片的问题

FaustCplus插件内置的函数的读取版本低于本地flash版本(查看本地flash版本),去该插件的github网址看了下相关的as源码,发现该文件只检查flash从9到12的版本,这之外的都是按break处理,因此添加的图片预览不成功,代码如下(文件为FaustCplus-master\view\browse\BrowseComp.as)

private function onFileSelected(event:Event) : void

{

this._fileRef.removeEventListener(Event.SELECT, this.onFileSelected);

this._fileRef.removeEventListener(Event.CANCEL, this.onCancel);

switch(this.Version)

{

case "12":

case "11":

case "10":

this._fileRef.load();

this._fileRef.addEventListener(Event.COMPLETE, this.refPicOK);

break;

case "9":

this._parent.localPicArea.loaddingUI.visible = true;

this._parent.localPicArea.loaddingUI.play();

if (this._parent.localPicArea.tip != null)

{

this._parent.localPicArea.tip.visible = false;

}

this.uploadFile();

break;

default:

break;

}

return;

}

由于本地版本是14,以后版本有可能升级为15甚至更高,因此需要把switch语句改为if判断来兼容以后不断升级的版本

private function onFileSelected(event:Event) : void

{

this._fileRef.removeEventListener(Event.SELECT, this.onFileSelected);

this._fileRef.removeEventListener(Event.CANCEL, this.onCancel);

if (this.Version == 9) {

this._parent.localPicArea.loaddingUI.visible = true;

this._parent.localPicArea.loaddingUI.play();

if (this._parent.localPicArea.tip != null)

{

this._parent.localPicArea.tip.visible = false;

}

this.uploadFile();

} else if (this.Version > 9) {

this._fileRef.load();

this._fileRef.addEventListener(Event.COMPLETE, this.refPicOK);

}

}

2、FaustCplus头像上传成后不执行uploadevent函数

var returnData = JSON.decode(_json);

这句话无法执行,获取returnData的值,输出为“undefinded”

用flash cs6调试了,说decode 不是函数,顶部调用:import com.adobe.serialization.json.*;

因为cs6内置json了。

JSON.decode换成JSON.parse,然后去掉顶部的json引用,就这样解决了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: