flash
Forward……maaaaaach.
Thursday, July 16th, 2009 | Keith Morgan's Blog, teh internets | No Comments
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!
zoom zoom….
Thursday, July 16th, 2009 | Keith Morgan's Blog, teh internets | No Comments
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 += (
videoSprite.height += (
}
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!
Who can em-bed now..who can it, who can it
Tuesday, June 9th, 2009 | Keith Morgan's Blog, teh internets | No Comments
Embedded players are in season again. Everyone wants to save their bandwidth and suck up yours. But who’s got your player? Well, I had this problem at GameVee and lemme be the first to formally tell you….the Flash runtime is stupid (on purpose though, its been crippled).
Anyway, how do you know what domain your player is being viewed at? Simple huh? just get the old Application.application.url, huh? Well…correct. This will show you where the swf lives, but not where it is….so, looks like you sux.
..so what the !@#$ is that supposed to mean?
when you call the play function in your player just add a line:
var testString:String = ExternalInterface.call(“function() { return document.location.href; }”);
then use a sendToURL() to post the data.
Honestly, I keep forgetting this stuff, so maybe you don’t sux that much.
Autobuilds…rollout!
Wednesday, April 22nd, 2009 | Keith Morgan's Blog, teh internets | No Comments
The art of auto building flash is a lost art. Recently, I had to publish 19 Flash CS4 video players quickly and we weren’t prepared to port anything over to Flex. I was pretty much screwed.
..so what the !#@$ is that supposed to mean?
After about 4 days of manual builds. I’d had enough. I searched the interwebs for any signs of auto building Flash found out JSFL (JavaScriptFlash) for MX2004. Well..Apparently its still supported in CS4 and I was able to piece together a jsfl file from examples from the web:
Create a new text document named “publish.jsfl” and add the following:
fl.openDocument(“file:///<path-to>.fla”);
curr_doc = fl.getDocumentDOM();
curr_doc.publish();
curr_doc.close();
fl.quit(true);
Save and simply run, assuming you’re in the same directory as the publish.jsfl file.
C:/Program Files/Adobe/Adobe Flash CS4/Flash.exe publish.jsfl
Well, once the build process was down to a few exe commands, I created a batch file (win32) to execute the exe’s. But since we (and most people who have never used Windows before Win2000) use ant, I converted the build process:
<property name=”publish.jsfl” value=”publish.jsfl”/>
<property name=”flash” value=”C:/Program Files/Adobe/Adobe Flash CS4/Flash.exe”/>
<exec executable=”${flash}”>
<arg line=”‘${publish.jsfl}’” />
</exec>
Be warned. using multiple jsfl files will open/close the application and may cause corruption in the swf’s.
If google rules teh search, youtube rules teh vidz
Saturday, November 1st, 2008 | personal vendettas | No Comments
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.
Find
Currently
There are no events to show at this time.