|
-
Please could you help
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
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
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
-
FK'n_dog
on frame#2, try using a new event listener name -
PHP Code:
var listenerObject2:Object = new Object();
listenerObject2.cuePoint = function....
video2.addEventListener("cuePoint", listenerObject2);
-
thank you for replying
at the moment your advice has not worked, would you be so kind as to advise a way of checking that my cuepoints are working as they should be
many thanks
adrian
-
FK'n_dog
check the FLV file metadata
PHP Code:
var listenerObject:Object = new Object();
listenerObject.metadataReceived = function(eventObject:Object):Void {
var i:Number = 0;
trace("This FLV contains the following cue points:");
while(i < my_FLVPlybk.metadata.cuePoints.length) {
trace("\nName: " + my_FLVPlybk.metadata.cuePoints[i].name);
trace(" Time: " + my_FLVPlybk.metadata.cuePoints[i].time);
trace(" Type is " + my_FLVPlybk.metadata.cuePoints[i].type);
++i;
}
};
my_FLVPlybk.addEventListener("metadataReceived", listenerObject);
-
thank you for the coding
the coding that was provided outputted at the start each cue point in the video.
so my thoughts would be that the .flv video would be working as expected.
so this brings me to another problem.
if the video is working but the file is not working then would i be right to believe that the coding is not working.
as you can see, i was advised to change the event listener name
PHP Code:
var listenerObject2:Object = new Object();
listenerObject2.cuePoint = function....
video2.addEventListener("cuePoint", listenerObject2);
as i see it, this was unable to rectify my problem
any further help would be greatly appreciated
thank you for your time
adey
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|