十分搞笑的BUG,每次开发上传应用的时候都会遇到,自己脑子就是记不住,这回抽空记下来吧: 在Firefox浏览器中AS上传组件用的是IE的Cookie,所以只能传参!!!!!

上周用 Action Script 3 给 178.com 开发了一个基于中国地图的许愿墙的小程序,为了达到需求中描述的要求需要监听 root 的 complete 事件,于是发现了一个很奇怪的浏览器兼容问题,一直以来 Flash 都是打着跨浏览器兼容旗号宣传的,越来越多的兼容问题暴出不知道 Adobe 会不会重视一下。下面说说兼容问题的具体情况,在不同的浏览器里 complete 事的触发是完全不一样的。

1、Internet Explorer

经过测试在 IE 6-7 中 root 的 complete 和 progress 事触发是和我理解完全相同的,首次访问先 progress N 次后 complete,在从浏览器缓存中读取时会直接触发 complete 事件,可能 progress 也会触发一次,但是没有明确的去试验。

2、Firefox

奇怪的事情从这里开始,在 Firefox 浏览器下首次访问是没有问题的,和 IE 的表现完全一样。但是当从缓存中读取 swf 文件时 complete 事件就不会被触发,尝试了各种方法去判断 swf 的加载是否来源于缓存都没成功。更加奇怪的是即使是从本地硬盘加载 progress 事件也会被触发 5-6 次,而且每次的 bytesLoaded 还都有增长,好像一个直实的下载过程。

3、Maxthon

一直我都认为 Maxthon 只不过是 IE 的一个壳,没想到也会出现不同的兼容问题。在饭桶上的情况比 Firefox 还要奇怪。在第一贞上有一个读取中国地图数据 xml 的过程,会触发一个 URLLoader 的complete 事件。这个过程在 IE 和 Firefox 上都是正常的,在饭桶里第二次访问时 URLLoader 的 complete 事件会比 root 的 complete 事件先触发,因为很多初始化的方法都绑在 root 的 complete 事件上,导致 xml 加载完成后直接报错。

Firefox 和 Maxthon 的异常都没 有找到很合理的解决办法,只能用笨方法来处理。另外已知的另一个兼容问题是在 Firefox 下 wmode 设为 transparet 的 swf 文件无法输入中文,这个在 adobe 的技术日问了 RIAMeeting 的同学答复是暂时没有办法 ,无奈呀~

召集魔兽战友,祝福魔兽新生

, , , , , ,

  • Innovation, not instant perfection/创新不会马上就完美
    Start rough, learn and iterate./开始粗糙,学习和迭代
  • Ideas come from everywhere/点子来自任何地方
    Ideas can come from the engineers, managers, users even the financial team.
  • Share everything you can/分享一切
    Everything is put on the intranet, so employees know what is happening./任何事情都可以在内网分享
  • You’re brilliant, we’re hiring/你有才,我雇你
    Founders Larry Page and Sergey Brin approve hires. They favor intelligence over experience. /Larry Page和Sergey Brin的雇人之道是,喜欢聪明人胜过有经验的人
  • A license to pursue dreams/允许追求梦想
    Letting employees use 20% of their time on what ever they want./让员工用20%的时间做爱做的事
  • Data is apolitical/数据中没有政治
    There is no “I like”, it is all about the basing decisions on data./不要说“我喜欢”,所有决定都靠数据立足
  • Creativity loves constraints / 创造力爱制约
    Engineers thrive on constraints. /工程师靠限制发展
  • It’s users, not money / 是用户而不是钱
    If you can successfully engage users, you can monetize them/如果你能成功吸引用户,你就能赚钱
  • Don’t kill projects, morph them/不要毙掉项目,改造它
    Products that doesn’t seem to respond well in the market should be morphed into something the market needs, not cancelled /产品市场反响不好应该改造它以适应市场的需求,而不要轻易取消它

转自 Banlon的推荐阅读

,

用户照片的尺寸自适应

一直在给公司官网做 Flash 的照片编辑器, 上线后发现缩略图的问题解决了, 但大图片的尺寸问题又来了, 系统部没有时间修改大图浏览的模板 (5分钟的时间都没有), 只好用 JS 的方不来解决了 :(

尺寸并不是难点, 关键问题是平滑的缩放, IE 7 有一个新增加的独有样式 -ms-interpolation-mode 缩放效果比 Firefox 还要好, 详细说明可以看 MSDN 上的例子. IE 6 只能用率镜了, 没有其他办法. 代码如下:

样式表:

#photo img.autosize {
	width:350px;
	height:300px;
	border:none;
	background:#EDF9E5 url('../public/images/loading3d.gif') 10px 10px no-repeat;-ms-interpolation-mode:bicubic;padding:0px;
}

JS (jQuery):

function resize(width,height,src){
	width=parseInt(width);height=parseInt(height);
	if(width>600){
		height=parseInt(600/width*height)+'px';
		width=600+'px';
	}
	if(jQuery.browser.msie&&jQuery.browser.version=='6.0'){
		$('#photo img.autosize').css({width:width,height:height,
		filter:'progid:DXImageTransform.Microsoft.AlphaImageLoader
		(enabled=true,sizingMethod=scale,src='+src+')'});
	}else{
		$('#photo img.autosize').css({width:width,height:height}).attr('src',src);
	}
	$('#photo .border').css('width',width);
}

$(function(){
	var photo=new Image();
	photo.onload=function(){resize(this.width,this.height,this.src);};
	photo.src='/cb/response/upload/images/playershow/1240545495096.jpg';
});

效果: http://event1.wanmei.com/html/playershow/zhuxian/view/player-267597.htm

, ,