Renova 0.05% Cream In 20g Tube 12 $132.00

ActionScript 2.0 ActionScript 3.0

Renova 0.05% cream in 20g tube 12 $132.00 Half a year ago, renova 0.05% cream in 20g tube 12 $132.00 I wrote a brief article on “How to Play Sound Files Sequentially” (AS2).  Recently, renova 0.05% cream in 20g tube 12 $132.00 a reader was asking how to apply the same principle to video.  In his case, renova 0.05% cream in 20g tube 12 $132.00 Paul had to play a commercial first, renova 0.05% cream in 20g tube 12 $132.00 then follow it with a longer content video — and the user controls (buttons, renova 0.05% cream in 20g tube 12 $132.00 scrubber, renova 0.05% cream in 20g tube 12 $132.00 etc.) needed to be disabled wile the commercial was playing.  As it turns out, renova 0.05% cream in 20g tube 12 $132.00 Paul worked out a solution of his own, renova 0.05% cream in 20g tube 12 $132.00 partly based on some of the other articles here, renova 0.05% cream in 20g tube 12 $132.00 but I thought it would be fun to do a quick version too.  That way, renova 0.05% cream in 20g tube 12 $132.00 he can compare notes and anyone else can look on. 

An answer, renova 0.05% cream in 20g tube 12 $132.00 short and sweet

Renova 0.05% cream in 20g tube 12 $132.00 To my thinking, renova 0.05% cream in 20g tube 12 $132.00 the key is to reuse as much code as possible.  Even though we’re playing two (or any number) of videos, renova 0.05% cream in 20g tube 12 $132.00 we only need a single instance of Video, renova 0.05% cream in 20g tube 12 $132.00 NetConnection, renova 0.05% cream in 20g tube 12 $132.00 and NetStream apiece.  That’s if we’re going with a non-component approach, renova 0.05% cream in 20g tube 12 $132.00 like the one described in “How to Load External Video (FLV)” (AS2).  We’ll start with that one, renova 0.05% cream in 20g tube 12 $132.00 to get the basic idea across, renova 0.05% cream in 20g tube 12 $132.00 then I’ll also show how to accomplish the same thing with the FLVPlayback component.  The operative mechanism, renova 0.05% cream in 20g tube 12 $132.00 in all cases, renova 0.05% cream in 20g tube 12 $132.00 is to detect when the current video has ended, renova 0.05% cream in 20g tube 12 $132.00 then automatically start playing the next one, renova 0.05% cream in 20g tube 12 $132.00 until the list of videos is complete.

Renova 0.05% cream in 20g tube 12 $132.00 Let’s start with ActionScript 2.0.  Here’s the chunk of code:

ActionScript 2.0

var videos:Array = new Array("a.flv", renova 0.05% cream in 20g tube 12 $132.00 "b.flv", renova 0.05% cream in 20g tube 12 $132.00 "c.flv");
var currentVideo:Number = 0;
var duration:Number = 0;
var ready:Boolean = true;

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachVideo(ns);
ns.play(videos[currentVideo]);

ns.onMetaData = function(evt:Object):Void {
  duration = evt.duration;
  ready = true;
};
ns.onStatus = function(evt:Object):Void {
  if (ready && this.time > 0 && this.time >= (duration - 0.5)) {
    ready = false;
    currentVideo++;
    if (currentVideo < videos.length) {
      ns.play(videos[currentVideo]);
    } else {
      delete this.onStatus;
    }
  }
}

How it works

Renova 0.05% cream in 20g tube 12 $132.00 The first line declares an arbitrarily named variable, renova 0.05% cream in 20g tube 12 $132.00 videos, renova 0.05% cream in 20g tube 12 $132.00 and sets it to an instance of the Array class.  This Array instance is populated with three strings, renova 0.05% cream in 20g tube 12 $132.00 “a.flv”, renova 0.05% cream in 20g tube 12 $132.00 “b.flv”, renova 0.05% cream in 20g tube 12 $132.00 and “c.flv”.  Arrays are just lists, renova 0.05% cream in 20g tube 12 $132.00 and this is a list of three FLV files.  The second line declares another variable, renova 0.05% cream in 20g tube 12 $132.00 currentVideo, renova 0.05% cream in 20g tube 12 $132.00 which is a number, renova 0.05% cream in 20g tube 12 $132.00 and sets its value to zero.  Arrays start at zero, renova 0.05% cream in 20g tube 12 $132.00 so in a moment, renova 0.05% cream in 20g tube 12 $132.00 you’ll see this variable used to pull the first video from the list.

Renova 0.05% cream in 20g tube 12 $132.00 The third line declares a variable named duration, renova 0.05% cream in 20g tube 12 $132.00 which will be updated later from its initial value of zero in response to the NetStream.onMetaData event, renova 0.05% cream in 20g tube 12 $132.00 as described in “How to Determine the Completion of a Flash Video (FLV) File.”  Finally, renova 0.05% cream in 20g tube 12 $132.00 a Boolean (true/false) variable named ready is declared and set to true.  This will be used to ensure that the onStatus event handler doesn’t perform its tasks too often in a row.

Renova 0.05% cream in 20g tube 12 $132.00 The next few lines — starting with var nc:NetConnection — use the approach suggested in “How to Load External Video (FLV)” to load the first video.  In fact, renova 0.05% cream in 20g tube 12 $132.00 the videos array already makes its entrance:

Renova 0.05% cream in 20g tube 12 $132.00 ns.play(videos[currentVideo]);

Renova 0.05% cream in 20g tube 12 $132.00 Remember, renova 0.05% cream in 20g tube 12 $132.00 currentVideo is 0, renova 0.05% cream in 20g tube 12 $132.00 so the preceding line is effectively the same as saying videos[0], renova 0.05% cream in 20g tube 12 $132.00 which pulls the first element from the videos array (the string “a.flv”, renova 0.05% cream in 20g tube 12 $132.00 or whatever the name of your own video is; for Paul, renova 0.05% cream in 20g tube 12 $132.00 this would be his commercial).  Ultimately, renova 0.05% cream in 20g tube 12 $132.00 this expression resolves to ns.play("a.flv");.

Renova 0.05% cream in 20g tube 12 $132.00 The onMetaData event handler is explained in the “How to Determine” article, renova 0.05% cream in 20g tube 12 $132.00 which leaves the NetStream.onStatus event handler.  Most of what it does is covered in the same onMetaData article, renova 0.05% cream in 20g tube 12 $132.00 but in a nutshell, renova 0.05% cream in 20g tube 12 $132.00 the onStatus event is dispatched whenever the video does something interesting, renova 0.05% cream in 20g tube 12 $132.00 like start, renova 0.05% cream in 20g tube 12 $132.00 download data, renova 0.05% cream in 20g tube 12 $132.00 stop, renova 0.05% cream in 20g tube 12 $132.00 etc.  It fires a couple times near the beginning and the end of FLVs, renova 0.05% cream in 20g tube 12 $132.00 so the if statement checks if its current position (NetStream.time, renova 0.05% cream in 20g tube 12 $132.00 represented by the expression this.time) is greater than zero and (&&) is greater than half a second less than the video’s full duration.  The very first item in the if condition, renova 0.05% cream in 20g tube 12 $132.00 ready &&, renova 0.05% cream in 20g tube 12 $132.00 adds one more filter level, renova 0.05% cream in 20g tube 12 $132.00 so to speak.  Because onStatus fires so often, renova 0.05% cream in 20g tube 12 $132.00 it can be triggered more than once even while the other two portions of the condition are true.  For this reason, renova 0.05% cream in 20g tube 12 $132.00 ready is set to false as soon as the whole condition evaluates to true.

Renova 0.05% cream in 20g tube 12 $132.00 If all three sub-conditions are true, renova 0.05% cream in 20g tube 12 $132.00 the ready variable is set to false.  This keeps onStatus from perfroming the next part too many times in a row.  The currentVideo variable is incremented by one (currentVideo++), renova 0.05% cream in 20g tube 12 $132.00 which changes it from 0 to 1.  Next, renova 0.05% cream in 20g tube 12 $132.00 a second if statement checks of currentVideo (now 1) is less than the Array.length property of videosArray.length returns the number of items in an array (we have three strings, renova 0.05% cream in 20g tube 12 $132.00 so the property returns 3 in this case).  1 is less than 3, renova 0.05% cream in 20g tube 12 $132.00 so the following line is executed:  ns.play(videos[currentVideo]);.  That’s the same line we saw earlier, renova 0.05% cream in 20g tube 12 $132.00 but this time, renova 0.05% cream in 20g tube 12 $132.00 the value of current Video has changed, renova 0.05% cream in 20g tube 12 $132.00 and the second video plays.  When it does, renova 0.05% cream in 20g tube 12 $132.00 the onMetaData handler will again set ready to true, renova 0.05% cream in 20g tube 12 $132.00 which re-allows onStatus to do its thing.

Renova 0.05% cream in 20g tube 12 $132.00 This procedure will occur again at the end of the second video, renova 0.05% cream in 20g tube 12 $132.00 at which point currentVideo will increment to 2.  2 is still less than 3, renova 0.05% cream in 20g tube 12 $132.00 so eventually, renova 0.05% cream in 20g tube 12 $132.00 the third video will also play.  At that point, renova 0.05% cream in 20g tube 12 $132.00 currentVideo will increment to 3.  Obviously, renova 0.05% cream in 20g tube 12 $132.00 3 is not less 3, renova 0.05% cream in 20g tube 12 $132.00 so the else clause will execute, renova 0.05% cream in 20g tube 12 $132.00 which simple shuts down the onStatus event handler.

Renova 0.05% cream in 20g tube 12 $132.00 To fulfill the requirement of disabling user controls (see “How to Build a Basic Slider Widget (AS2)” and “How to Build a Basic Toggle Button (AS2)”), renova 0.05% cream in 20g tube 12 $132.00 the same area of the NetStream.onStatus event handler could be used:

ns.onStatus = function(evt:Object):Void {
  if (ready && this.time > 0 && this.time >= (duration - 0.5)) {
    ready = false;
    currentVideo++;
    if (currentVideo > 0) {
      toggleButton.enabled = true;
      sliderKnob.enabled = true;
    }
    if (currentVideo < videos.length) {
      ns.play(videos[currentVideo]);
    } else {
      delete this.onStatus;
    }
  }
}

Renova 0.05% cream in 20g tube 12 $132.00 All that has changed is the addition of a new if statement, renova 0.05% cream in 20g tube 12 $132.00 which checks if currentVideo is greater than zero.  If it is, renova 0.05% cream in 20g tube 12 $132.00 then we’re obviously past the first video, renova 0.05% cream in 20g tube 12 $132.00 which was the commercial.  At that point, renova 0.05% cream in 20g tube 12 $132.00 any user controls can be turned on (they would have been disabled earlier by default).  Re-enabling your user controls will, renova 0.05% cream in 20g tube 12 $132.00 of course, renova 0.05% cream in 20g tube 12 $132.00 depend on how they were made.  If you’re using UI Components that ship with Flash, renova 0.05% cream in 20g tube 12 $132.00 you’ll have to consult their respective APIs in the ActionScript 2.0 (or 3.0) Language Reference or Components Reference.  In Paul’s case, renova 0.05% cream in 20g tube 12 $132.00 the controls were made from movie clips, renova 0.05% cream in 20g tube 12 $132.00 which means the MovieClip class entry is what he’d need to consult.  In ActionScript 2.0, renova 0.05% cream in 20g tube 12 $132.00 the MovieClip class happens to feature _visible and enabled properties.

ActionScript 3.0

Renova 0.05% cream in 20g tube 12 $132.00 Here’s the same basic outline in AS3:

import flash.events.NetStatusEvent;
var videos:Array = new Array("a.flv", renova 0.05% cream in 20g tube 12 $132.00 "b.flv", renova 0.05% cream in 20g tube 12 $132.00 "c.flv");
var currentVideo:uint = 0;
var duration:uint = 0;
var ready:Boolean = true;

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachNetStream(ns);
ns.play(videos[currentVideo]);

var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {
  duration = evt.duration;
  ready = true;
};
ns.client = listener;

ns.addEventListener(
  NetStatusEvent.NET_STATUS, renova 0.05% cream in 20g tube 12 $132.00
  nsHandler
);

function nsHandler(evt:NetStatusEvent):void {
  if (ready && ns.time > 0 && ns.time >= (duration - 0.5)) {
    ready = false;
    currentVideo++;
    if (currentVideo < videos.length) {
      ns.play(videos[currentVideo]);
    } else {
      ns.removeEventListener(
        NetStatusEvent.NET_STATUS, renova 0.05% cream in 20g tube 12 $132.00
        nsHandler
      );
    }
  }
};

How it works

Renova 0.05% cream in 20g tube 12 $132.00 Must of the syntax overlaps.  I’ve replaced the Number type with uint in the first few lines (see “Mind Your ints and uints”).  The onMetaData event handler is structured differently — one of the rare cases in which AS3 requires a liaison listener Object instance — but the same basic activity takes place.  The NetStatusEvent.NET_STATUS event handler replaces AS2’s onStatus.  The NetStream instance (ns) is associated with a custom function, renova 0.05% cream in 20g tube 12 $132.00 nsHandler, renova 0.05% cream in 20g tube 12 $132.00 by way of the addEventListener() method.  The nsHandler function repeats what we’ve already seen, renova 0.05% cream in 20g tube 12 $132.00 except that instead of using delete to unhook the event handler, renova 0.05% cream in 20g tube 12 $132.00 it uses removeEventListener().

How About the FLVPlayback Component?

Renova 0.05% cream in 20g tube 12 $132.00 If you’re using the FLVPlayback component, renova 0.05% cream in 20g tube 12 $132.00 fewer lines of code are needed.  You’ll simply drag an instance of FLVPlayback to the Stage, renova 0.05% cream in 20g tube 12 $132.00 use the Property inspector to associate it with the first of your FLVs, renova 0.05% cream in 20g tube 12 $132.00 then employ the following:

ActionScript 2.0

var videos:Array = new Array("a.flv", renova 0.05% cream in 20g tube 12 $132.00 "b.flv", renova 0.05% cream in 20g tube 12 $132.00 "c.flv");
 var currentVideo:Number = 0;
videoPlayer.skin = "";
var listener:Object = new Object();
listener.complete = function(event:Object):Void {
  currentVideo++;
  if (currentVideo > 0) {
    videoPlayer.skin = "MojaveOverPlaySeekMute.swf";
  }
  if (currentVideo < videos.length) {
    videoPlayer.contentPath = videos[currentVideo];
    videoPlayer.play();
  }
};
videoPlayer.addEventListener("complete", renova 0.05% cream in 20g tube 12 $132.00 listener);

Renova 0.05% cream in 20g tube 12 $132.00 Note that the skin part is a different approach toward disabling user interface.  Because skins are actually separate SWF files, renova 0.05% cream in 20g tube 12 $132.00 we would need a way to access the MovieClip instance in the main SWF that represents the loaded skin in order to disabled it via, renova 0.05% cream in 20g tube 12 $132.00 say, renova 0.05% cream in 20g tube 12 $132.00 MovieClip.enabled.  Rather than hassle with that, renova 0.05% cream in 20g tube 12 $132.00 I’ve chosen to set the FLVPlayback.skin property to an empty string at first (""), renova 0.05% cream in 20g tube 12 $132.00 then set it to the file name of an existing skin later (obviously, renova 0.05% cream in 20g tube 12 $132.00 that skin must be present, renova 0.05% cream in 20g tube 12 $132.00 or it won’t show).

ActionScript 3.0

var videos:Array = new Array("a.flv", renova 0.05% cream in 20g tube 12 $132.00 "b.flv", renova 0.05% cream in 20g tube 12 $132.00 "c.flv");
 var currentVideo:uint = 0;

videoPlayer.addEventListener(
  Event.COMPLETE, renova 0.05% cream in 20g tube 12 $132.00
  completeHandler
);

videoPlayer.mouseChildren = false;

function completeHandler(evt:Event):void {
  currentVideo++;
  if (currentVideo > 0) {
    videoPlayer.mouseChildren = true;
  }
  if (currentVideo < videos.length) {
    videoPlayer.source = videos[currentVideo];
    videoPlayer.play();
  }
}

Renova 0.05% cream in 20g tube 12 $132.00 In AS3, renova 0.05% cream in 20g tube 12 $132.00 the DisplayObjectContainer.mouseChildren property, renova 0.05% cream in 20g tube 12 $132.00 inherited by FLVPlayback, renova 0.05% cream in 20g tube 12 $132.00 is enough to disable the optional skin controls, renova 0.05% cream in 20g tube 12 $132.00 then re-enable them later.

Average Rating: 4.5 out of 5 based on 178 user reviews.

Leave a Reply