Brian Chia
       
 
categories
actionscript
actionscript 1.0
actionscript 2.0
misc
 
processing
 
links
brian chia
kelvin zhao
ronald leong
 
 
Browser Animation v01
 

Most of us have seen how we can scale / animate the height of a movieclip in a flash movie, but how about using a button in the flash movie to animate the browser height. I did a very simple sample to demostrates that this is possible with actionscript and javascript.

If you guys had notice, i use getURL method to communicate with javascript instead of fsCommand, reason is being that fsCommand might had problem working on Mac OS.

I also include Robert Penner's Sine easing formula so that my browser will animate with a easeOut effect.

Click here to see browser animation

// variables for Robert Penner Sine easing formula
var begin:Number=800;
var end:Number=300;
var diff:Number=end-begin;
var time:Number=0;
var duration:Number=30;

var nV:Number=0;
var oV:Number=nV;

function animate(v:Number):Void{

// use getURL to pass variable to javascript
getURL("javascript:resizeWindow("+v+");");

}

animate_btn.onRelease=function():Void{

onEnterFrame=function():Void{

// find the value to animate
oV=nV;
nV=diff*Math.sin(time++/duration*(Math.PI/2));
animate(nV-oV);

if(time>duration) onEnterFrame=null;

}

}



suggestion

 
 
 
         
  © copyright 2007 THINKLUNATIC.    
Brian Chia Jonathan Ng