I am a frontend developer and author based in the UK, specializing in JavaScript development and application architecture. I founded Newtriks Ltd. and have been remotely contracting for the last 10 years for global corporations and venture-backed start-ups. I regularly consult Angular, Backbone, and React, and train programmers in test-driven development. I'm an enthusiastic open source contributor and am the cofounder and lead developer of the live webcasting platform Sayansho Ltd. Please contact me to discuss your specific business requirements.
I dig the way Flex can pass a Value Object to ColdFusion, I doubly dig the way ColdFusion can pass a Value Object back to Flex. What I wanted amongst all this digging was to run a query in a cfc and convert the result of that query into a value object to return to Flex.
Heres an example of how to do this, picture the scene…. The skies are blue and the sea is lapping around your feet, from out of the water comes a fine lookin’ life guard with a her user id, now you want all her details.
Following on from my last PureMVC tutorial for Flash CS3 I have written a next step tutorial on how to build and implement a Proxy to the FLV player to incorporate a xml playlist file. I have published this article on the new voices blog at puremvc.org.
As a PureMVC project owner I will now be using voices as a main central resource for blogging about PMVC and linking to these from my blog here.
Check out the next step to creating a simple video playlist:
My latest piece of work was working with Stefan building 2 Flash media players for Freecaster TV, whilst I concentrated on the progressive player Stefan built the live streaming player. We both buzzed of this project cos of the video content, awesome skating, breakdancing, bmx etc. And to top it off this weekend they are streaming skating live in Stef’s player, the full screen will knock your socks off, honestly its wicked check it out on Stef’s site:
http://www.flashcomguru.com/index.cfm/2008/1/25/simpelsession!!!!
Related to my previous tutorial I want to detail another way into a Flash CS3 application with PureMVC. In the above tutorial I detailed a MovieClip on the Stage in the Flash IDE and I then set up a linkage from this MovieClip to a class CS3VideoPMVC. Its in this class that we create the instance to the ApplicationFacade and fire up the whole framework. If you note, I have various MovieClip instances in this main clip and reference them in the CS3VideoPMVC class.
I have previously run into trouble with mac os x hidden files and the old .DS_Store when using SVN and also for uploading tutorial files. I have run the various scripts in Terminal to delete files and also to show and hide hidden files but was shown this utility which works a dream and saves be a LOT of hastle and time, check it out:
If your creating the FLVPlayback dynamically using ActionScript and want to set the skin to none the component is expecting a String. So in the component inspector your select none so I assumed “none” in my code would work… nah, got to set it to null.
WARNING * THE FLV CONTAINED WITHIN THIS DEMO TUTORIAL CONTAINS MILDLY OFFENSIVE LANGUAGE FROM A RECORD BEING PLAYED WHILST BEING SCRATCHED IN A RHYTHMIC MANNER ☺
NOTE This app uses the pre V2 PMVC package ** update coming soon!
This is a really basic application constructed using Flex Builder for all ActionScript code and Flash CS3 for the visual components. The purpose of the tutorial is to show how to construct a simple Flash CS3 application using the PureMVC framework. The tutorial should give you working knowledge of how to interact with components on the stage in Flash from within the PureMVC framework. We will use the FLVPlayback component as an example and create an event listener in a mediator to listen out for a click on the FLVPlayback component. This tutorial will not be going into great depth about the framework but simply give you a step by step guide of how to get the framework up and running in a real life application.
I have noticed there are not to many resources for building a scrubber to use in a custom Flex video application. I have noticed a great start located here at Flex Examples for use with the VideoDisplay control, however, I tend to create a class that extends UIComponent and pops in a Video Object. So in comparison to the above tutorial I track playhead time and length of flv content from the NetStream and MetaData. So in a nut shell here is a simplified version of how I built the scrubber, this is snatch and grab code from my player so has elements of the framework I use (PureMVC), I will work on a simple demo in another post yo:
Main workflow is:
+ HSlider thumb value changes according to the current NetStream time using a Timer event
+ HSlider thumb pressed and NetStream paused, Timer reset
+ HSlider thumb released and NetStream seeks to HSlider release point value
+ Timer restarted and NetStream start play
HSlider component
123456789101112
<mx:Metadata>
[Event("press")]
[Event("release")]
</mx:Metadata>
<mx:Script>
<![CDATA[
public static const PRESS:String = "press";
public static const RELEASE:String = "release";
]]>
</mx:Script>
Class receiving dispatched events from Hslider component
1234567891011121314151617181920212223242526
private function setDuration():void
{
avHolder.scrubber.minimum = 0;
avHolder.scrubber.maximum = meta.duration;
}
private function trackProgress( ns_time:Number ):void
{
// Dispatched current time value of the net streams play position
avHolder.scrubber.value = ns_time;
}
// Started scrubbing so pause the stream
private function onScrubStart( e:Event ):void
{
sendNotification( ApplicationFacade.CONTROL_STREAM, "pause" );
}
// Tell the class handling the nest stream what the time value of the scrubber was on release
private function onScrubStop( e:Event ):void
{
var scrubTime:Number = avHolder.scrubber.value;
sendNotification( ApplicationFacade.SCRUB, scrubTime );
}
Class handling Net Stream
1234567891011121314151617181920212223242526272829
// This method is called every 10 ms using the Timer class
public function scrubStream( scrubTime:Number ):void
{
// Scrubber moved and released
ns.seek( scrubTime );
// Rebuild the timer
buildDurationTimer();
// Start playing stream
ns.togglePause();
}
// Called when the scrubber is pressed, ensures the timer is removed and the stream is paused
public function pauseStream():void
{
ns.pause();
resetTimer();
}
public function resetTimer():void
{
t.stop();
t.reset();
t.removeEventListener( TimerEvent.TIMER, timerHandler );
}
public function toggleStream():void
{
ns.togglePause();
}
I have recently developed a Flex upload component using PureMVC. The component is based on a TitleWindow and displayed as a popup window. I hit a small obstacle involving Mediator registration which was due to the upload component instance not being created until I call the createPopUp() method from the PopUpManager class. The solution (thanks Cliff) came from this helpful post in the PureMVC forum (thanks daniele) and here is some of the code snippets from my application that got things running:
PopManager.as
1234567891011121314151617
public class PopManager extends PopUpManager
{
public static function openPopUpWindow( ComponentClass:Class, MediatorClass:Class ):void
{
var window:IFlexDisplayObject = PopUpManager.createPopUp( Application.application as Sprite, ComponentClass, true );
ApplicationFacade.getInstance().registerMediator( new MediatorClass( window ) );
PopUpManager.centerPopUp( window );
}
public static function closePopUpWindow( window:IFlexDisplayObject, mediatorName:String ):void
{
PopUpManager.removePopUp( window );
ApplicationFacade.getInstance().removeMediator( mediatorName );
}
}
I have a CanvasStage.mxml component which holds a button which when clicked dispatches an Event to its mediator and opens the popup window.
The upload component is UploadForm.mxml with the TitleWindow default close button dispatching an Event to the UploadEventMediator calling the below method.
UploadFormMediator.as
123456
public static const NAME:String = 'UploadFormMediator';
private function onClose( e:Event ):void
{
PopManager.closePopUpWindow( uploadForm, NAME );
}