Toe 的个人资料Stuff that won't get you...日志列表 工具 帮助
    8月25日

    Flash Games and frameRate

    Browsers, browsers and more browsers. If you're a flash game developer, you've probably been upset about the performance from browser to browser. I used to crank up the ol'FPS in my FLA's and hope they would run smooth in all browsers. Besides that being a horible practice and usually making the problem worse, it hasn't been much of a problem with actionscript 3. 
     
    If you work with animators, they can be quite peculiar about how their work is presented, and as they should be. There's no silver bullet frame rate that you can set your movies too( action games primarily), since it's dependant on the browser.  
     
    If you create an swf where it's framerate is set to 24 and you play it back in Firefox 3, your fps will be 24( windows ) and just about every other browser will do 20 - 22fps. That's really not that big of a deal you say, but  the animators you work with will grumble and call you names till the end of time or atleast until you can make their work display as intended.
     
    So here is a little hack I use when showing previews of games/applications when animation is under scrutiny.
    if( ExternalInterface.available )
    {
    	var js:String = "function(){ return navigator.userAgent; }";
    	var browser:String;
    	try{
    		browser= String(ExternalInterface.call(js)).toLowerCase(); 
    	}catch(e:Error){}
    	
    	if( browser.indexOf("firefox") != -1 ){
    		stage.frameRate = 24;
    	}
    	else if( browser.indexOf("safari") != -1 ){
    		stage.frameRate = 30;
    	}
    	else if( browser.indexOf("msie") != -1 ){
    		stage.frameRate = 30;
    	}
    }
    
    

    This works pretty well, it just adjusts the frame rate ever so slightly to get the playback to always be 24fps in the browser.
    Now, this little hack also makes some asumptions as well. It assumes the allowScriptAccess is set to "samedomain" or "always" and people are using the latest & greatest browser of their choice.

    Not sure if this will help anyone, but I felt it was way too long since I posted something. In the coming weeks I'll be posting some samples of how I work with FlexBuilder and Flash CS3 when developing games.

    -T
     
     

    评论 (1)

    请稍候...
    很抱歉,您输入的评论太长。请缩短您的评论。
    您没有输入任何内容,请重试。
    很抱歉,我们当前无法添加您的评论。请稍后重试。
    若要添加评论,需要您的家长授予您相应权限。请求权限
    您的家长禁用了评论功能。
    很抱歉,我们当前无法删除您的评论。请稍后重试。
    您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
    因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
    完成下面的安全检查,您提供评论的过程才能完成。
    您在安全检查中键入的字符必须与图片或音频中的字符一致。

    若要添加评论,请使用您的 Windows Live ID 登录(如果您使用过 Hotmail、Messenger 或 Xbox LIVE,您就拥有 Windows Live ID)。登录


    还没有 Windows Live ID 吗?请注册

    stu evans发表:
    Damn animators ;)    .   Keep the posts coming!
    8 月 28 日

    引用通告

    此日志的引用通告 URL 是:
    http://littleono.spaces.live.com/blog/cns!A7AF3696CCDBAB2E!170.trak
    引用此项的网络日志