Using cue points to trigger events on the main timeline...
Hi--
I have successfully placed an flv (video) file (progressive
download) on the main timeline of my movie with controls to play
and pause (Flash 8 Professional). So far, so good!
NOW TWO PROBLEMS: Does anyone know how to set it up so that
when a specific cue point is reached in the video, it triggers an
action on the main timeline? In this case, once the video is over,
I want the main timeline to gotoAndPlay frame 3. Specific script to
do this would be great!
The other action I'd like to happen is that when the video
begins, it targets a scrolling text mc ("text") in the main
timeline and tells it to gotoAndPlay frame 2.
Any advice would be GREATLY appreciated!!! Many
thanks!!!
I usually start off solving problems with the livedocs, as I
recommend for anyone. The following link will take you to the
NetStream.onCuePoint handler. This is what you need.
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00002561.html
You can have this code on the main timeline. When the
cuepoint is hit, it will invoke this event handler and inside is
where your gotoAndPlay( ) should go.
Your other question about the text will get activated by the
same handler. Just have a conditional statement (if, switch, etc.)
to differentiate between the two events. The text itself can be
mask inside a movieclip.
Does this help?
Similar Messages
-
Control a mc timeline from the main timeline
Hi there,
On my main timeline, I load a mc from the library with:
text_content.attachMovie("text_content", "text_content", 10);
There is a marker inside this mc called "news". I need a script in the main timeline that will gotoandStop "news" within the "text_content" mc.
I have tried, amongst others unsuccesfully:
text_content.gotoAndStop("news", 10);
_level10.gotoAndStop("news");
Can anyone tell me how to fix this?
Many thanksHi, thanks for your help. To describe the scenario a bit better...
I have an empty mc on the stage called "text_content_mc".
On the first frame of the main timeline, I load a library mc 'text_content' (identifier name: text_content) into "text_content_mc" using:
text_content_mc.attachMovie("text_content", "text_content", 10);
From the main timeline, I have attempted to navigate to marker "news" within the library mc, now inside "text_content_mc" using:
text_content_mc.text_content.gotoAndStop("news");
It is not working. What I am doing wrong?
Hope this makes sense. Thanks. -
Controlling external information using cue points
Hello,
I am trying to change information on my site using cue points in my video. My video is in a flash quiz and I am trying to change my objects such as an ad or photo with these cue points. In otherwords, when a video begins, or when a cue point is reached the photo outside the video would change. I am currently using cue points to go to the next frame after the video completes, but I don't know how to make it change things outside the video. Thank you for your help.I'm sure there is more than one way to skin this cat, but here is what I use with NetStream video to load other .swfs (could be photos or other videos) at certain points in the main video:
ns.onCuePoint = function(evt:Object){
trace(evt.name);
trace(evt.time);
if(evt.name == "play_vid1") {
trace("YO!Loading wide_holder!");
wide_holder.loadMovie("rm/images/black_bear.swf");
if(evt.name == "play_vid2") {
trace("YO!Loading standard_holder!");
standard_holder.loadMovie("rm/images/sqis.swf");
in this case using an "event" cue point object embedding at certain times in the video.
Lots of info on the Web, here is just one:
http://www.communitymx.com/content/article.cfm?cid=124DB
Best wishes,
Adninjastrator -
Use cue points to automatically pause flv
I have a video that I would like to make play in steps. I
already have a custom flv playbar, so I would like to use cue
points to control it
Thanks in advancei am looking for this same answer. i am not a pro at flash
but good enough to make my way around. Here is what I have done so
far....
using components i dragged the FLVPlayBack onto stage, i set
the source of the playback to my flv. as of right now, 'cuepoints'
is set to none. i'd like to be able to set in about 5 cue points
and have them auto pause each time they come up. any help would be
appreciated!
thanks,
travis -
Problems Using Cue points to Loop Video
Ok, so I want to use cue points to navigate through video. I want to start by simply looping the video from the end back to the beginning. I keep getting an invalid seek error 1003. Here is my code. Any help would be much appreciated. Thanks
import fl.video.MetadataEvent;
Movie.addEventListener(MetadataEvent.CUE_POINT, loopFunction);
function loopFunction(e:MetadataEvent):void
if (e.info.name == "end1")
Movie.seekToNavCuePoint("beginning1");
Movie.play();At least you are getting notified even if the seek doesn't work.
A brief workaround could be to iterate over the cue points you detect in metadata, assigning each cue point name and time in an object. Once you hit the cue point you desire, see if the object has the time value and seek() to the time for that cue point rather than seeking for it by name.
e.g. (written briefly, you get the idea):
// object to hold time values
var cuePointArr:Object = new Object();
function onMetaData(infoObject:Object):void
var cueIndex:String;
for (cueIndex in infoObject.cuePoints)
trace("Adding cue name[" + infoObject.cuePoints[cueIndex].name + "] at time[" + infoObject.cuePoints[cueIndex].time + "]");
// store as name = time
cuePointArr[infoObject.cuePoints[cueIndex].name] = infoObject.cuePoints[cueIndex].time;
function loopFunction(e:MetadataEvent):void
// correct cue point and has a value in cuePointArr?
if ((e.info.name == "end1")&&(curPointArr[e.info.name] != null))
// seek to time value
Movie.seek(Number(cuePointArr[e.info.name]));
Movie.play();
Moving 900mph here so forgive any typos but turning it into a normal seek based on the time value should work for now. -
FLV/Mp3 Cue Points for Accessing Frame Labels on the Main Timeline in Flash 8
Hello,
In Flash MX2004, creating cue points for syncing locations on
flv and mp3 files to locations on the main timeline included:
1) Dragging a media component onto the stage
2) Entering file path, frame label name, and time code
information in the component inspector
3) Creating the frame label names on the main timeline, and
4) Enabling the Media Labeled Frame Cue Point Navigation
Behavior
Flash 8 documentation details a considerably different
process of creating cue points. While it discusses how to create
cue points in the flv, I have not been able to locate how to enable
linking locations in flv and mp3 files with frame labels on the man
timeline. It appears that there would need to be ActionScript
necessary to accomplish this that is not available in the docs.
Please advise what ActionScript/process would enable this
function.
Thank you!
James
[email protected]I usually start off solving problems with the livedocs, as I
recommend for anyone. The following link will take you to the
NetStream.onCuePoint handler. This is what you need.
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00002561.html
You can have this code on the main timeline. When the
cuepoint is hit, it will invoke this event handler and inside is
where your gotoAndPlay( ) should go.
Your other question about the text will get activated by the
same handler. Just have a conditional statement (if, switch, etc.)
to differentiate between the two events. The text itself can be
mask inside a movieclip.
Does this help? -
Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?
code on the last frame of your movieclip instance:
_root.gotoAndStop('whatever_frame'); // will work unless this swf is loaded into another swf. in that situation, you should use a relative path to the main timeline (eg, _parent or _parent._parent etc). -
Using an mc to control the main timeline with multiple scenes
OK, I have a main timeline that has 27 different scenes. I have a movie clip that is an "on call" navigation menu for the main timeline. I can call the menu once, and it will go to the first place I want it to go. However, I cannot seem to figure out how to get it to go away to be able to call it again. I get the "must be child of caller" error. Any thoughts on how to get rid of it each time I use it?
A button is clicked which calls the following AS3 code:
MovieClip(this.root).addChild(myMenu); -
Use timeline of a nested mc to affect the main timeline
Hi I have a magic cloud effect. On frame 30 of the nested effect I would like an mc on the main timeline to become visible.
Not too sure how to code with frame numbers,
a) Do I put AS on the timeline of the nested clip OR
b) Write code on the main timeline to listen for when the nested mc gets to frame 30
CheersHi
I got to the bottom of it.
As you say really bad practise to bury code - had enough of that in AS2 and template monster.
Realised that you could do all this from the main time line and therefore have everything visible.
import flash.events.*;
hero.visible = false;
cloud.addEventListener(Event.ENTER_FRAME, handler);
function handler (e:Event) {
if (cloud.currentFrame == 21) {
hero.visible = true;
THANKS -
How do I recerence Movie Clips on the Main Timeline from inside a class?
Hey everyone, this might be a stupid question but I thought
I'd ask cause it's making me nuts. I'm all of 2 days into AS3
(coming from not using Flash at all in YEARS) so feel free to
consider me ignorant. I do have plenty of application development
experience in other areas though.
I can't seem to create a class that can reference an instance
of a movie clip on my main timeline. I'd post code of what I've
tried but I've gone through so many desperate edits & wild
guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe
it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true
object oriented environment, I wouldn't need to mix my code and
interface together. Preferably I'd be using the Flash authoring
tools just to design my interface. Create a button... place it
somewhere... give it an instance name. Roughly the equivilant of
Apple's InterfaceBuilder for those of you that might be familiar
with Cocoa development. I can see maybe having to put a few lines
of ActionScript onto frame 1 (though really I'm hoping Flash would
have a better method of kicking off the application at this point
that using code tied to frames) to load my classes & such, but
after that I'd like all of my code to be held in external class
files.
So maybe I've got:
Interface.fla - My interface
Button_1
Button_2
TextField_1
Main.as - My main controller class using to handle all of my
applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method
to go ahead & attach events to buttons & initialize
anything else that needs to happen when the application starts.
From there on it would all be objects communicating back &
forth. Button_1 would get clicked with would fire
Main.someMethod(). Main.someMethod() would then do it's thing and
set the value of TextField_1. All very clean & code is very
separated from interface.
Unfortunately I can't for the life of me figure out how AS3
classes reference each other like that. There doesn't seem to be
any kind of a global 'root' or '_root' I can use to locate any
movie clips on the stage. I've searched the help & the web for
any kind of simple tutorial but to no avail. My job has tasked me
with building a flash app for a project but I'd really rather not
have a tone of ActionScript just shoved into frame 1. That just
seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm
really willing to do my homework but I can't seem to locate the
info I need to get started. Also, is there an ActionScript IRC
channel or something maybe?
Thanks,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
Controlling a Movie Clip on the Main Timeline from a loaded SWF?
Is it possible to control a MovieClip on the main timelne from another loaded clip?
I see posts that control loaded clips, but most are all from the loader in the main timeline. I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
If I try to call the movieClip from the loaded SWF I get "error #1119. Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline.
The old AS2 way just used "_root". Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
trace(MovieClip(parent.parent));
The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way. Here's a rough outline of it...
AS3 - Dispatch Event
http://forums.adobe.com/thread/470135?tstart=120
Example:
Add something to trigger the event in the child (your loaded swf):
dispatchEvent(new Event("eventTriggered")); (
if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo. In the complete event handler, add a listener for the event on the loaded swf.
// event handler triggered when external swf is loaded
function loaderCompleteHandler(event:Event) {
MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
function eventHandler(event:Event):void {
trace("event dispatched in loaded swf");
// this is where your main file can set the visible property of your movieclip -
Trying to make the switch from AS2 to AS3 and like many
before me, becoming confused.
I've laid out three movieClips on my main timeline (named,
"main") and spaced them five frames apart, nice and tidy, like I
like to do. Each frame on the main timeline containing a movieClip
has been given a unique frame label. My problem is, I want to have
the movieClips jump to the next targeted movieClip on the main
timeline after clicking a button, or upon entering the last frame
of its predecessor, in some cases. In AS2 the was easy to do this
was by using the gotoAndPlay function and targeting to the_root
timeline. Now I can't figure out what to do. I can make any button
inside a movieClip target a specific frame within that same mc, but
cannot make a jump to the main timeline to play the next movieClip.
What am I missing here? I'm a noobie at AS3 and fumbling my
way forward. (should be obvious now) Is there a simple way to refer
back to the main timeline, which is only one level up? What am I
missing?
Here's as far as I got with the AS3 code within the mcs:
stop();
cont5_mc.addEventListener(MouseEvent.CLICK, onClick2);
function onClick2(event:MouseEvent):void
trace("test");
cont5_mc.buttonMode = true;
The trace function runs true so it's a matter of telling the
player how to get to the main timeline and frame label.
TIA for your help, all you flashy genius . . . Speak to me
like I am a three year old. -grin-
thokittskglad:
Thank you for your instant reply. I see you sent it out last
night. Really appreciated. Got my button in movieClip1 to refer
back to movieClip2 on the main timeline with your help but now am
presented with the issue of having the last frame of movieClip2
automatically taking the viewer back to the main timeline to begin
playing movieClip3, located on frame label "gsm".
Again, I know this should be easy, but conceptually I am
having a problem with how to do this. I don't have a button to
attach the AS3 to and this new syntax is confusing to me. Nor do I
want this to be a button based decision on the viewer's part. How
do I attach this automatic jump back to the main timeline, frame
label "gsm"? By an enterFrame event, which seems old school AS2? or
stage.addEventListener? Is enterFrame even the way to do it
anymore?
Lynda.com tutorials are great but I'm struggling with this.
TIA
Thomas -
How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?
on this link http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
I found this script, but I can not use it can anyone help me
// create a variable to reference swf1's main timeline
var swf1Main_mc:MovieClip; // this assumes that swf1 is a movieclip.
// create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
// reference to its main timeline (which is always the main timeline of the loading swf).
this.addEventListener(Event.ADDED_TO_STAGE, initF);
function initF(e:Event):void{
swf1Main_mc = MovieClip(this.root);You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
var loader:Loader = new loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
//rest of your loader loading code here
protected function onLoaderLoaded(e:Event):void {
//add to display list (you already know how to do, so I'm not writing the code)
EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
//if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
//this is what you actually need to care about to do this correctly
customSwf = LoaderInfo(e.target).content as CustomSwf;
Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
protected function fEvent(e:Event):void {
dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
back in your main document Class:
//should probably call from the constructor or somewhere early in the process
protected function init():void {
//use your real event name--your code isn't expressive enough I could guess a good name
addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
protected function onEventHappened(e:Event):void {
customSwf.customFunctioninSwf1();
customSwf.changeVisualState();//let custom swf change alpha and change the frame #
To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day). -
Use button on mc to perfrom function on main timeline
I Was wondering how (or if it is posiible) to use a button I
have in a movie clip to perform a function on the main timeline.
Specifically, I want the button in the movie clip to gotoAndStop on
a frame in the main timeline. Any suggestions?Hi,
Then you would target the movie clip.
So you would give the mc an instance name (like myClip_mc )
then just add this into your code ....
button1.onRelease = function() {
_root.myClip_mc.gotoAndStop(20);
This would tell the myClip_mc to stop on frame 20. Providing
the mc is located in the main timeline that is.
You can see from the code that we are going to the _root and
looking for the myClip_mc. If it is held within another mc (say
Holder_mc) then the code would change to
_root.Holder_mc.myClip_mc.gotoAndStop(20;
for cs3 (actionscript 3) it would be this
button1.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(event:MouseEvent):void{
_root.myClip_mc.gotoAndStop(20);
Hope this helps
Alan -
Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?
I have a buttons that play to symbols on the timeline. Once another button is clicked on the timeline the symbol will playout then start playing the next symbol. This is the code used on the onClick event on the introduction button.
var current = sym.getVariable("current");
if (current != "") {
sym.getSymbol(current).play("out");
sym.getSymbol("intro").play("in");
else {
sym.getSymbol("intro").play("shortIn");
sym.setVariable("current", "intro");
The problem I'm having is with the technology symbol. I have buttons within this symbol that link to other symbols. I would like these symbols to playout like the other buttons, but the content of the symbol stays on the stage and does not play out when I select a button on the Stage. Here is the code I have on the click event on the button within the symbol.
var current2 = sym.getVariable("current2");
if (current2 != "") {
sym.getSymbol(current2).play("out");
sym.getSymbol("optical1").play("in");
else {
sym.getSymbol("optical1").play("shortIn");
sym.setVariable("current2", "optical1");
Any help would be greatly appreciated. Thank you very much!Thank you very much for responding so quickly! When I do this all of the nested timelines play from the out label on their timeline. I want the one that is currently being viewed to be the only one that plays out, not all of the symbols within the symbol. Here is the code I'm using on the buttons on the main timeline:
var current = sym.getVariable("current");
if (current != "") {
sym.getSymbol(current).play("out");
sym.getSymbol("spec").play("in");
else {
sym.getSymbol("spec").play("shortIn");
sym.setVariable("current", "spec");
var techSym1 = sym.getSymbol("tech").getSymbol("techSym1")
if (current = "techSym1") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym1").play("out");
var techSym2 = sym.getSymbol("tech").getSymbol("techSym2")
if (current = "techSym2") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym2").play("out");
var techSym3 = sym.getSymbol("tech").getSymbol("techSym3")
if (current = "techSym3") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym3").play("out");
var techSym4 = sym.getSymbol("tech").getSymbol("techSym4")
if (current = "techSym4") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym4").play("out");
var techSym5 = sym.getSymbol("tech").getSymbol("techSym5")
if (current = "techSym5") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym5").play("out");
var techSym6 = sym.getSymbol("tech").getSymbol("techSym6")
if (current = "techSym6") {
sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym6").play("out");
If just techSym1 is being shown on the screen I don't want techSym2 and all the others to be shown going out at all, just techSym1.
Thank you,
Kristin
Maybe you are looking for
-
Not getting all of the results from ALL_OBJECTS in Procedure
I created the following procedure under a DBA account. The procedure selects info from ALL_OBJECTS. When I execute the procedure under this same DBA account, It does not return objects of all owners; only owners like SYSTEM, SYS, PUBLIC, and the DBA
-
Multiple videos load at once and start playing creating sound mess and sucking up ram. This is happening on Firefox on both Windows 8 and Windows 7 machines. This started about three weeks ago. I have run Avast, malwarebytes, hitman pro, and other ma
-
PM: Printing Task List Attachments When printing Shop Floor Papers
Hi, We have PDF documents attached to our PM Task Lists. My requirement is to print out these PDF attachments when the shop floor papers (ie Maintenance Pick List) print. I am able to determine each of the files and their paths attached to the task l
-
i create a passcode on my iphone 5 but i forget it and i can not use my device ..i want to remove this passcode without making format or restore to avoid loosing my data..any other solution..? or can i make a backup before restoring..? please help me
-
Hi Im about to set up a converged access solution with WLC 5760 as MC and several 3850 as MA. It is not clear to me what needs to be configured on the MC and what needs to be configured on the MA´s. I know that each MA has to be configured with the