in a previous thread the users Silentweed and Samac1068 helped me with a query regarding using a variable to generate either a win situation and a lose situation. firstly thank you to them.
the video instance in the first frame is called Video1
the video instance in the Second frame is called Video2
There is a hazard button in each frame. hazardbtn1 and hazardbtn2 in relation to frame 1 and frame 2.
also there is the NxtVid button. used to take the user to the next frame, and the next video.
Each video uses 4 cuepoints, these are called "start", "Hazard1", "Hazard2" and "end".
the code that i am using is for the first frame is
Quote:
stop();
trace("Video 1");
NxtVid1._visible = false;
var listenerObject:Object = new Object();
var inBound:Boolean = false;
listenerObject.cuePoint = function(eventObject:Object):Void {
if(eventObject.info.name=="Hazard1")
{
inBound = true;
}
else if(eventObject.info.name=="Hazard2")
{
inBound = false;
}
else if(eventObject.info.name=="End"){
NxtVid1._visible = true;
}
}
Hazardbtn1.onRelease = function(){
if(inBound)
{
trace("You win.");
}
else
{
trace("You lose.");
}
}
NxtVid1.onRelease = function(){
gotoAndStop(2);
}
video1.addEventListener("cuePoint", listenerObject);
the code used in frame 2 is
Quote:
stop();
trace ("Video 2");
inBound = false;
var listenerObject:Object = new Object();
var inBound:Boolean = false;
listenerObject.cuePoint = function(eventObject:Object):Void {
if(eventObject.info.name=="Hazard1")
{
trace ("hazard 1");
//inBound = true;
}
else if(eventObject.info.name=="Hazard2")
{
inBound = false;
}
else if(eventObject.info.name=="End")
{
trace("Click Here for next clip")
}
}
Hazardbtn2.onRelease = function(){
if(inBound)
{
trace("You win.");
}
else
{
trace("You lose.");
}
}
NxtVid2.onRelease = function(){
gotoAndStop(3);
}
video2.addEventListener("cuePoint", listenerObject);
at the moment the first frame plays and works as expected, however the second frame does not work as i wish. whenever i press the hazardbtn2 button when between the first and second hazard cuepoints, it displays the message "you lose".
it seems to me that the second frame code does not recognise the cuepoints in the second video/frame.
i was advised to add a reset variable to reset it to false state by adding inBound = false;. as you can see i have done that
any help that you can provide would be greatly appreciated
many thanks
adrian
