as3

Forward……maaaaaach.

Thursday, July 16th, 2009 | Keith Morgan's Blog, teh internets | No Comments

No Gravatar

More Flash video player PDL code. This time, Fast forward and reverse. Basically you set a timer that counts for you.


private const PLAYHEAD_UPDATE_INTERVAL_MS:uint = 10;
public var rewFF:Timer = new Timer(PLAYHEAD_UPDATE_INTERVAL_MS);


public function ffcontroller():void {
< button >.removeEventListener(MouseEvent.MOUSE_DOWN, ffcontroller);
video.pause();
rewFF.start();
rewFF.addEventListener(TimerEvent.TIMER, ffmotioncontroller);
this.addEventListener(MouseEvent.MOUSE_UP, ffstopcontroller);
}
public function ffstopcontroller(pEvent:MouseEvent):void {
rewFF.stop();
rewFF.removeEventListener(TimerEvent.TIMER, ffmotioncontroller);
rewFF.reset();
video.play();
ffBtn.addEventListener(MouseEvent.MOUSE_DOWN, ffcontroller);
}
public function ffmotioncontroller(event:TimerEvent):void {
elapsedTime = (time_elapsed + rewFF.currentCount);
video.seek(Number(elapsedTime.toFixed(1)));
}

…for reverse, just subtract the time_elapsed from the current count. You will also need a good number of frames embedded in your video for this to look cool.

Enjoy!

Tags: , , , , ,

zoom zoom….

Thursday, July 16th, 2009 | Keith Morgan's Blog, teh internets | No Comments

No Gravatar

Cleaning out some of my flash video player junk and ran across a basic zoom in/out function for progressive download players. Assuming your video object is the child of a sprite (videoSprite):


public function zoomincontroller(pEvent:MouseEvent):void {
//move and scale sprite
videoSprite.x -= ;
videoSprite.y -= ;
videoSprite.width += (*2);
videoSprite.height += (*2);
}
public function zoomoutcontroller(pEvent:MouseEvent):void {
//reset sprite
videoSprite.x = 0;
videoSprite.y = 0;
videoSprite.width = stage.stageWidth;
videoSprite.height = stage.stageHeight;
}

….never really got around to retooling it. The basic concept is that you scale and reposition the Sprite the video is in. Obviously you will need a high-res video for this to look like anything…

Enjoy!

Tags: , , , , , , ,

If google rules teh search, youtube rules teh vidz

Saturday, November 1st, 2008 | personal vendettas | No Comments

No Gravatar

So my new employer has a client that wants to implement the slide player API. “No prob” I say, with confidence since I see that there is an AS3 version….”It’s gotta plug right in if it’s written in AS3…”

Well…two days into it and I’m stumped.   I can get the slide video player to load my AS3 chromeless player but cant get the stupid throbber to stop….Read the API you say?  Well, its based on the youtube AS2 API and it contains an event listener that was listening for onStateChange.  There’s no !@#@! onStateChange in AS3!..and to add insult to injury, Google came up nada!

…so what the !@#$ is that supposed to mean?

Well, I finally read the fine print and figured out I needed to send event calls thru the root object ( in my case, a movieclip which the document class extended) when the video state changed:

switch (ns.state) {
case “unstarted” :
this.dispatchEvent(new Event(“onStateChange”,0));
break;

…and voila! All is well in the world….for now….I have a few more events to dispatch.

Tags: , , , ,

Find

Currently

There are no events to show at this time.

Fix