Created
July 28, 2011 21:49
-
-
Save newtriks/1112666 to your computer and use it in GitHub Desktop.
Fluent snippets example usage in a Flex project. Configuration is set via mxml params which are then used to build a strongly typed Object in a Fluent fashion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<media:MediaContainer id="mediaContainer" | |
aspectRatio="{VideoBase.WIDE_SCREEN}" | |
verticalCenter="0" | |
horizontalCenter="0" | |
bandwidth="32768" | |
logHandler="{log}" | |
layoutHandler="{resize}"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
SNIPPET | |
extends VideoContainer.as | |
MediaBase extends VideoBase.as | |
--> | |
video=new MediaBase(new VideoConfigurationVO(baseType) | |
.aspectRatio(aspectRatio) | |
.client(client) | |
.layoutCallbackHandler(layoutHandler) | |
.logCallbackHandler(logHandler) | |
.quality(quality) | |
.bandwidth(bandwidth) | |
.microphoneRate(microphoneRate) | |
.microphoneSilenceLevel(microphoneSilenceLevel) | |
.fps(fps)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** --- SNIPPET --- **/ | |
public function get data():VideoConfigurationVO | |
{ | |
return _configuration; | |
} | |
public function get baseType():String | |
{ | |
return data.baseType; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @author: Simon Bailey <simon@newtriks.com> */ | |
package com.newtriks.core | |
{ | |
public class VideoConfigurationVO | |
{ | |
public function VideoConfigurationVO(baseType:String) | |
{ | |
_baseType=baseType; | |
} | |
private var _baseType:String; | |
public function get baseType():String | |
{ | |
return _baseType; | |
} | |
internal var _aspectRatio:String=VideoBase.STRETCH_SCREEN; | |
public function aspectRatio(value:String):VideoConfigurationVO | |
{ | |
_aspectRatio=value; | |
return this; | |
} | |
internal var _client:Object; | |
public function client(value:Object):VideoConfigurationVO | |
{ | |
_client=value; | |
return this; | |
} | |
internal var _layoutCallbackHandler:Function; | |
public function layoutCallbackHandler(value:Function):VideoConfigurationVO | |
{ | |
_layoutCallbackHandler=value; | |
return this; | |
} | |
internal var _logCallbackHandler:Function; | |
public function logCallbackHandler(value:Function):VideoConfigurationVO | |
{ | |
_logCallbackHandler=value; | |
return this; | |
} | |
internal var _bandwidth:uint; | |
public function bandwidth(value:uint):VideoConfigurationVO | |
{ | |
_bandwidth=value; | |
return this; | |
} | |
internal var _quality:uint; | |
public function quality(value:uint):VideoConfigurationVO | |
{ | |
_quality=value; | |
return this; | |
} | |
internal var _fps:uint; | |
public function fps(value:uint):VideoConfigurationVO | |
{ | |
_fps=value; | |
return this; | |
} | |
internal var _microphoneRate:uint; | |
public function microphoneRate(value:uint):VideoConfigurationVO | |
{ | |
_microphoneRate=value; | |
return this; | |
} | |
internal var _microphoneSilenceLevel:uint; | |
public function microphoneSilenceLevel(value:uint):VideoConfigurationVO | |
{ | |
_microphoneSilenceLevel=value; | |
return this; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** --- SNIPPET --- **/ | |
private var _bandwidth:uint=32768; | |
public function get bandwidth():uint | |
{ | |
return _bandwidth; | |
} | |
public function set bandwidth(value:uint):void | |
{ | |
_bandwidth=value; | |
} | |
private var _quality:uint=0; | |
public function get quality():uint | |
{ | |
return _quality; | |
} | |
public function set quality(value:uint):void | |
{ | |
_quality=value; | |
} | |
private var _microphoneRate:uint=22; | |
public function get microphoneRate():uint | |
{ | |
return _microphoneRate; | |
} | |
public function set microphoneRate(value:uint):void | |
{ | |
_microphoneRate=value; | |
} | |
private var _microphoneSilenceLevel:uint=0; | |
public function get microphoneSilenceLevel():uint | |
{ | |
return _microphoneSilenceLevel; | |
} | |
public function set microphoneSilenceLevel(value:uint):void | |
{ | |
_microphoneSilenceLevel=value; | |
} | |
private var _fps:uint=15; | |
public function get fps():uint | |
{ | |
return _fps; | |
} | |
public function set fps(value:uint):void | |
{ | |
_fps=value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment