Otis Curtis



leave a comment »

These first lines of ActionScript set the variables. The first couple of lines state that the video starts paused and the sound is on.

var isVideoPlaying:Boolean = false;
var isVideoSoundOn:Boolean = true;
var videoFileName:String = “Imports/PortfolioSize_1.flv”;
var videoPlayer:MovieClip = videoHolder;

var videoPlay:MovieClip = play_btn;
var videoPause:MovieClip = pause_btn;

My site requires videos with Alpha preserved, as I need them to appear as if on walls. The best filetype for doing this is FLV, and the only way to get FLVs into Flash is with the NetStream command. The following code is how to get the FLVs into a MovieClip.

var videoNetConnection:NetConnection = new NetConnection();
videoNetStream = new NetStream(videoNetConnection);

videoNetStream.onMetaData = function(obj)
 videoPlayer._height = obj.height;
 videoPlayer._width = obj.width;
 videoLength = obj.duration;

videoLoadCheck = setInterval(checkBytesLoaded, 1, videoNetStream);

The following code sets the buttons for playing and stopping the video. They are both the same size and position as the video, effectively making the frame for the video its own play/pause button.

function pauseVideo() {
 isVideoPlaying = false;


function playVideo(){
 isVideoPlaying = true;

videoPlay.onRelease = function(){

videoPause.onRelease = function (){ 

As the two buttons are in the same place, I need to hide the play button whilst the video is playing and hide the pause button whilst the video is paused. The same happens with the volume.

function videoStatus(){
 if (isVideoPlaying == true){ 
  _parent.isTrailerPlaying = true;
  videoPause._visible = true;
  videoPlay._visible = false;   
 }else if (isVideoPlaying == false){ 
  _parent.isTrailerPlaying = false;
  videoPause._visible = false;
  videoPlay._visible = true;

function volumeControl(){
 if (isVideoSoundOn == true){
  videoMute._visible = true;
  videoUnMute._visible = false;
 }else if (isVideoSoundOn== false){
  videoMute._visible = false;
  videoUnMute._visible = true;

The final part of code restarts the video when it is finished.

function restartVideo(){
 var adjustVideoProgress  = setInterval(videoProgress,10)


Written by otiscurtis

November 9, 2009 at 8:26 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: