Skip to main content
August 18, 2008
Question

How do I reference an embedded cue point with AS?

  • August 18, 2008
  • 4 replies
  • 472 views
I've looked for a solution to this in many forums and also in Flash help, but can't quite get the response I need.

I've embedded a cue point when encoding a video. The name of the cue point is cuePtEnd, time is 00:00:06.00 (6 secs), and type is Event. I did not define any parameters.

I'm attaching a video dynamically using NetConnection and NetStream, i.e. I'm not using components. My video loads and plays and all the video buttons work fine as well. I want my video to return to the beginning and stop when I click a button and/or cuePtEnd is reached. I've tried using seek(0), but this returns the video to the beginning and starts playing again.

I'm using the following code to activate something else on stage when cuePtEnd is reached and it works; however, the only reason this code works is because I've embedded only one cue point in my video file. How do I reference a specific cue point and not the first cue point that Flash finds in my video file?

This topic has been closed for replies.

4 replies

Inspiring
August 19, 2008
kabunia,

I should give you a heads-up ... I'll continue to check in on this
thread, but I'm about to leave for San Francisco in a few hours for
Flashforward. For the first time, I'm going to be attending without taking
a laptop (that's going to be refreshing!) ... so it will be several days
before I can reply ... in case you have additional questions.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."


Inspiring
August 19, 2008
kabunia,

> Your tutorials really helped me understand how to reference
> specific embedded cue points. Also, I understand how to
> check if a video has reached the end.

Nice. Glad to hear that. :)

> Once the video reaches the end, I want it to return to the
> beginning and stop. I need a function that's similar to
> gotoAndStop, and seekAndStop(0) is definitely not it, but
> don't think I didn't try it :)

Heh. Do you realize that all you have to do is look up the NetStream
class in the ActionScript 2.0 Language Reference, and you'll see everything
the class is capable of? No need to guess! Class entries describe the
objects they create. You'll find a list of the class's properties, which
are the characteristics it has. You'll find methods, which are the things
it can do. You'll find events, which are the things it can react to.

> I've also tried, my_ns.seek(0), and my_ns.pause(), but this does
> not truly stop at 00:00:00.00.

I would pause the stream first, then seek to 0. I wonder doing that in
reverse gives your video just enough time to advance a few frames past 0?


David Stiller
Contributor, How to Cheat in Flash CS3
http://tinyurl.com/2cp6na
"Luck is the residue of good design."


August 19, 2008
David, thanks again for your response. While Flash help is helpful, I really struggled finding a way to return a video to the beginning and stop. I also thought it would be simpler than having to use two functions, seek and pause. I will try your suggestion and use pause first, then seek(0).

I appreciate your time and enjoy SF...without the laptop.
August 18, 2008
David, thank you for you response. I posted a comment on your blog site.

Your tutorials really helped me understand how to reference specific embedded cue points. Also, I understand how to check if a video has reached the end. Once the video reaches the end, I want it to return to the beginning and stop. I need a function that's similar to gotoAndStop, and seekAndStop(0) is definitely not it, but don't think I didn't try it :). I've also tried, my_ns.seek(0), and my_ns.pause(), but this does not truly stop at 00:00:00.00.

I'm not using components. Any suggestions?

Thank you.
Inspiring
August 18, 2008
kabunia,

> I understand, for the most part, how this code works. Flash
> searches for any embedded cue point that does not contain
> parameters and once it's reached it traces the phrase.

I haven't tried your code in a practical application, but my hunch is
that it may not work as expected. Even if a cue point doesn't have
parameters, it may very well have a parameters *property* ... it's just be
that the property's value might be null. (This is ony a hunch, through, so
you should run some exeriments to test it for sure.)

The long and short of it is that you might want to check of the
cue_info.parameters property == null (or != null, as the case may be).

> But, how do I get Flash to disregard all other embedded
> cue points, and trace this statement only when cuePtEnd
> at 6 secs is reached?

You can always check the time property. (there are other properties
besides the parameters one you've seen).

See if this tutorial steers you in the right direction.

http://www.quip.net/blog/2007/flash/how-to-use-flash-video-cue-points

I'll be happy to answer additional questions, if you have any.


David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."