| Package | com.soma.view.video.skin |
| Class | public class SomaVideoPlaySkin |
| Inheritance | SomaVideoPlaySkin flash.display.Sprite |
| Implements | ISomaVideoPlaySkin |
Author: Romuald Quantin - www.soundstep.com
Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0
Copyright:
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.
The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.
Usage:
Default control skin for a SomaVideoPlayer play/pause/stop button, automatically instantiated by the SomaVideoControls class if you dont specify one in the SomaVideoPlayer instance.
How to add controls to the player
The following code is reproducing how the default controls are added in the SomaVideoControls class (by default).
var controls:SomaVideoControls = new SomaVideoControls();
controls.addControl(new SomaVideoPlaySkin());
controls.addControl(new SomaVideoTimeBarSkin());
controls.addControl(new SomaVideoMuteSkin());
controls.addControl(new SomaVideoFullscreenSkin());
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv", controls);
addChild(player);
package {
import com.soma.view.video.SomaVideoPlayer;
import com.soma.view.video.skin.ISomaVideoPlaySkin;
import flash.display.Sprite;
public class CustomPlaySkin extends Sprite implements ISomaVideoPlaySkin {
private var _player:SomaVideoPlayer;
public function CustomPlaySkin() {
createSkinElements();
}
private function createSkinElements():void {
// create play/pause/stop buttons here and use:
// _player.play();
// _player.resume();
// _player.stop();
// _player.pause();
}
public function registerPlayer(player:SomaVideoPlayer):void {
_player = player;
}
public function dispose():void {
// remove skin elements and events listeners for cleaning when the SomaVideoPlayer instance is disposed.
}
public function playCallBack():void {
// here the controller will indicate when the video starts to play.
trace("video is played");
}
public function pauseCallBack():void {
// here the controller will indicate when the video is paused.
trace("video is paused");
}
public function resumeCallBack():void {
// here the controller will indicate when the video is resumed.
trace("video is resumed");
}
public function stopCallBack():void {
// here the controller will indicate when the video is stopped.
trace("video is stopped");
}
}
}
var controls:SomaVideoControls = new SomaVideoControls();
controls.addControl(new CustomPlaySkin());
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv", controls);
addChild(player);
var player:SomaVideoPlayer = new SomaVideoPlayer("video/video.flv");
addChild(player);
var skin:SomaVideoPlaySkin = player.controls.getControl(SomaVideoPlaySkin) as SomaVideoPlaySkin;
skin.backgroundColor = 0xFF0000;
skin.backgroundAlpha = .5;
See also
| Property | Defined by | ||
|---|---|---|---|
| backgroundAlpha : Number Specifies the background transparency of the skin (default alpha 0).
| SomaVideoPlaySkin | ||
| backgroundColor : uint Specifies the background color of the skin (default is black).
| SomaVideoPlaySkin | ||
| buttonAlpha : Number Specifies the default transparency of the buttons (default alpha 1).
| SomaVideoPlaySkin | ||
| buttonColor : uint Specifies the default color of the buttons (default is white).
| SomaVideoPlaySkin | ||
| pauseButton : Sprite [read-only] Get the pause button.
| SomaVideoPlaySkin | ||
| playButton : Sprite [read-only] Get the play button.
| SomaVideoPlaySkin | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a SomaVideoPlaySkin instance.
| SomaVideoPlaySkin | ||
|
dispose():void
This method is internally called when you dispose a SomaVideoPlayer to remove children, the event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| SomaVideoPlaySkin | ||
|
pauseCallBack():void
Method called whenever the video is resumed.
| SomaVideoPlaySkin | ||
|
playCallBack():void
Method called whenever the video starts to play.
| SomaVideoPlaySkin | ||
|
registerPlayer(player:SomaVideoPlayer):void
Register the SomaVideoPlayer instance that will be used with the skin class
| SomaVideoPlaySkin | ||
|
resumeCallBack():void
Method called whenever the video is stopped.
| SomaVideoPlaySkin | ||
|
stopCallBack():void
Method called whenever the video is paused.
| SomaVideoPlaySkin | ||
| backgroundAlpha | property |
backgroundAlpha:Number [read-write]Specifies the background transparency of the skin (default alpha 0).
Implementation public function get backgroundAlpha():Number
public function set backgroundAlpha(value:Number):void
| backgroundColor | property |
backgroundColor:uint [read-write]Specifies the background color of the skin (default is black).
Implementation public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
| buttonAlpha | property |
buttonAlpha:Number [read-write]Specifies the default transparency of the buttons (default alpha 1).
Implementation public function get buttonAlpha():Number
public function set buttonAlpha(value:Number):void
| buttonColor | property |
buttonColor:uint [read-write]Specifies the default color of the buttons (default is white).
Implementation public function get buttonColor():uint
public function set buttonColor(value:uint):void
| pauseButton | property |
pauseButton:Sprite [read-only]Get the pause button.
Implementation public function get pauseButton():Sprite
| playButton | property |
playButton:Sprite [read-only]Get the play button.
Implementation public function get playButton():Sprite
| SomaVideoPlaySkin | () | constructor |
public function SomaVideoPlaySkin()Creates a SomaVideoPlaySkin instance.
| dispose | () | method |
public function dispose():voidThis method is internally called when you dispose a SomaVideoPlayer to remove children, the event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| pauseCallBack | () | method |
public function pauseCallBack():voidMethod called whenever the video is resumed.
| playCallBack | () | method |
public function playCallBack():voidMethod called whenever the video starts to play.
| registerPlayer | () | method |
public function registerPlayer(player:SomaVideoPlayer):voidRegister the SomaVideoPlayer instance that will be used with the skin class
Parametersplayer:SomaVideoPlayer — A SomaVideoPlayer instance.
|
| resumeCallBack | () | method |
public function resumeCallBack():voidMethod called whenever the video is stopped.
| stopCallBack | () | method |
public function stopCallBack():voidMethod called whenever the video is paused.