I am trying to create a system using Flash AS3 and videos. The idea is that all these videos are rooms and hallways in a building linked to each other, At the end of each video, i want an arrows to appear (left or right [or both]) in order...
I am trying to create a system using Flash AS3 and videos.
The idea is that all these videos are rooms and hallways in a building linked to each other,
At the end of each video, i want an arrows to appear (left or right [or both]) in order for the user to click, so that they can "go into the next room" by watching the next video.
The "undefined" part is to check if an object has a variable set, if the variable is not set it will be "undefined".
To know which is the current video, I think i need to store the object that relates to that video once it starts playing. So any time a video starts, store that object in the variable. But im not sure how to do this.
Here is the code i have so far below, any help would be great - i think im nearly there...
Code:
var object1:Object = new Object();
var object2:Object = new Object();
var object3:Object = new Object();
var object4:Object = new Object();
var object5:Object = new Object();
var object6:Object = new Object();
var object7:Object = new Object();
//adding labels and data associated with the list
object1 = {label: "Exterior 360" , data:"../MyFlashapp2/vid/exterior.flv"};
vidList.addItem(object1);
object2 = {label: "South and West Range, Lower Floor", data:"../MyFlashapp2/vid/path1.flv", coordx:90, coordy: 45, up

bject6, right

bject3};
vidList.addItem(object2);
object3 = {label: "North & East Range, Lower Floor" , data:"../MyFlashapp2/vid/path2.flv", coordx: -30, coordy: -30, right

bject6};
vidList.addItem(object3);
object4 = {label: "North & East Range, Upper Floor" , data:"../MyFlashapp2/vid/path3.flv", coordx: 20, coordy: -90, left

bject5, right

bject7};
vidList.addItem(object4);
object5 = {label: "West & South Range, Upper Floor" , data:"../MyFlashapp2/vid/path4.flv", coordx: -50, coordy: -10, left

bject7, right

bject4};
vidList.addItem(object5);
object6 = {label: "Up Stairs" , data:"../MyFlashapp2/vid/stairup.flv", coordx: -145, coordy: -40, left

bject4, right

bject5};
vidList.addItem(object6);
object7 = {label: "Down Stairs" , data:"../MyFlashapp2/vid/stairdown.flv", coordx: -120, coordy: 10, left

bject3};
vidList.addItem(object7);
//add the list to the program
addChild(vidList);
arrowL.addEventListener(MouseEvent.CLICK, playNextVideo);
arrowR.addEventListener(MouseEvent.CLICK, playNextVideo);
//Changing cursor to hand
arrowL.buttonMode = true;
arrowL.useHandCursor = true;
arrowR.buttonMode = true;
arrowR.useHandCursor = true;
//End Changing cursor to hand
//adding a complete listener to flvplayback to call a function whenever a video ends:
vid.addEventListener(VideoEvent.COMPLETE, addNextVideoControls);
function addnextVideoControls(e:VideoEvent):void{
//check if current video has a left video
if(currentObject.left != "undefined"){
// it has got a left so add a left button
var leftarrow:arrowL = new arrowL();
leftarrow.x = vid.x + vid.width - 400;
leftarrow.y = vid.y + vid.height - 100;
addChild(arrowL);
}
if(currentObject.right != "undefined"){
//it has got a right so add a right button
var rightarrow:arrowR = new arrowR();
rightarrow.x = vid.x + vid.width - 40;
rightarrow.y = vid.x + vid.height - 100;
addChild(arrowR);
}
}
function playNextVideo(Event):void{
vid.play();
}