«

»

Aug 01

Play a video when one has finished swishmax

how to check if a video has finished playing before loading another Swishmax 4.

Example:

Controls:
Right click on the video  to switch between videos and to stop playing video.

 First Of All:

You will need the vidoeObject from the components

if you cannot find it don’t know how to get it, Download the starter file below for swishmax 4.

http://www.swish-designs.co.uk/blog/wp-content/plugins/downloads-manager/img/icons/default.gif download: videoObject (6.83KB)
added: 01/08/2012
clicks: 82
description: Swishmax 4 flv Tutorial Starting file containing the videoObject from the components.

Step.1

Group the videoObject as a movieclip and name it player

On Scene_1 add the following script.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function link2(){
player.my_ns.pause()
}
function link1(){
player.my_ns.play("video2.flv"); 
player.Count=2;
}
function link0() {
     player.my_ns.play("video1.flv");  
     player.Count=1; 
}
onSelfEvent (load) {
MENU = new ContextMenu();
MENU.hideBuiltInItems();
Message0 = new ContextMenuItem("Play Video 1",link0);
Message1 = new ContextMenuItem("Play Video 2", link1);
Message2 = new ContextMenuItem("Stop Playing", link2);
MENU.customItems.push(Message0);
MENU.customItems.push(Message1);
MENU.customItems.push(Message2);
_root.menu = MENU;
}

Step.2

add the following script to the player movieclip

 

1
2
3
4
5
6
7
8
9
10
11
onSelfEvent (load) {
    var maxCount = 2; // how many number of flv's in the library
    var Count = 1; // starting number 
var my_nc : NetConnection = new NetConnection(); // new net connection
   my_nc.connect(null);
   var my_ns : NetStream = new NetStream(my_nc);
   videoObject.attachVideo(my_ns); // attach movie to netstream
   my_ns.play("video"+Count+".flv"); // loads movie from librabry
    my_ns.onStatus = function(info) {
   if (info.code == "NetStream.Play.Stop") { // checks if current netstream has finished playing
       if(Count

Video files need to be name video1, video2, video3 etc
some sample flv video files can be found here
Buy this tutorial file via paypal £2.50
the file is for swishmax 4 and does not contain any flv video files.

[paiddownloads id="122"]

Important!

please allow up to 24 hours for electronic delivery due to world time zones.
in most cases delivery is expected within 10 minutes.

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +2 (from 2 votes)
Play a video when one has finished swishmax, 5.0 out of 5 based on 2 ratings

Leave a Reply

9 visitors online now
6 guests, 3 bots, 0 members
Max visitors today: 18 at 09:08 am UTC
This month: 27 at 05-17-2013 01:24 pm UTC
This year: 39 at 01-01-2013 12:46 pm UTC
All time: 109 at 12-07-2012 11:00 pm UTC