Detecting the end of a movie clip

Hi,
Objective: Display a book that the user can turn the pages to
view more text. I used a tutorial from the web to create the
turning page.
Process: On layer 1, frame 1 of the main time line, I put an
image of a book. On layer 2, frame 1 and also frame 2 of the main
time line, I put text for the book. I then created a movie clip
(MC) called PageTurnMC that looks like a page in the book is being
turned. On layer 3 of the main time line, I put an instance of the
MC and called it PageTurn. On layer 4 of the main time line, I put
a button to play the MC and advance to frame 2 called drawer1cont
(see code).
//code on the button used to turn the book's page
on (release) {
PageTurn.play(); //plays my PageTurnMC
gotoAndStop("drawer1cont"); //advance to the next frame of
text
Problem: I need to detect when the end of the MC before I
advance to the next frame. I have to use the PageTurnMC many times,
so it is not possible for me to put the action in the last frame of
MC. As of right now, my frame 2 text appears as the PageTurnMC
plays which is not what I want.
Thanks for any help.

I just tested it and got my quick example to work. Here are a
couple of possible areas to double check:
In the last frame of PageTurnMC, gotoAndStop must reference
the main movie clip, e.g. _root.gotoAndStop().
Also, make sure the parameter _root.frameID isn't in quotes
because it is a variable, not the actual string.
As I said, I'm not a Flash expert nor do I know the setup of
your movie, but this should work as long as you have all of your
references correct. If you can't get it to work, try to trace
necessary variables to make sure you are accessing the appropriate
variable.
The suggestion by nilu_only will also work, but it will waste
some cycles because you will have to wait for the movie clip to
end. Here is what I mean:
Immediately after playing PageTurn, accessing
PageTurn._currentFrame will return the currentFrame only once. So
if PageTurn isn't on its lastFrame, your condition statement
(PageTurn_currentframe == PageTurn._totalframe) will fail and
gotoAndStop will never be called.
Instead, you would need to wait for some time and continually
check the _currentFrame until the condition statement is true, e.g:
on (release) {
PageTurn.play();
while (PageTurn_currentframe != PageTurn._totalframe) {}
//wait until reaches the last frame
gotoAndStop ("drawer1cont")
This approach is likely to be suboptimal since you are
wasting cycles checking the current frame instead of just having
the movie let you know when it has reached the last frame.
Depending on how Flash handles that while statement, you could have
serious slowdown from that while statement. And since Flash doesn't
have a sleep() function, you would have to do some sort of
setTimeout() to slow down those checks. Either way, I would venture
to say this approach is better off avoided.

Similar Messages

  • How to detect the end of a movie clip:  what eventListener to use?

    I'm doing a rather fancy button with up,down,rollover,rollout,and static states, something the standard flash button structure isn't capable of as far as I can tell, and believe me, I've tried it.
    Here's the setup:  My main timeline has a series of frames with stop(): scripts, and each frame has a movie clip representing what should happen during that state:  still, rollover, rollout, mousedown, mouseup
    I can't get the mouseup event  to work.
    Here's what I've tried so far that doesn't work:
    1. in the imbedded movieclip, no script at the end.  Result: This just loops the embedded clip.
    2. in the imbedded movieciip, put gotoAndPlay("NextFrame"), where "NextFrame" is the label in the root movie where I want to go. result: loops clip
    3. in the imbedded movieciip, put root.gotoAndPlay("NextFrame"), where "NextFrame" is the label in the root movie where I want to go. result: error
    I think what I need to do is write an eventListener for the root actionscript, but I don't know what event to listen for. 
    What event is thrown when a movieclip finishes playing?
    :<)McFrisco

    You have to create your own mechanism(s) for detecting the end of a movieclip being reached.  You can either build code into the end of the clip itself, possibly dispatching an event that is being listened for by a containing timeline, or you could continuously monitor the currentFrame of the clip to see if it equals the totalFrames value.

  • How to detect the end of an external swf loaded into a container

    Hi,
    I'm having trouble finding a solution for this problem, can somebody help me?
    I have a main swf that will load external swfs into a container. I need to detect the end of the loaded external swf in order to start to load and play a new one into the same container.
    The problem is that i do not know what the length of the external swfs will be, and will have no control over the development of them, so i cannot place a variable at the end of their animation which would allow me to detect from the main movie its end.
    I also cannot rely on the _totalFrames property because the loaded swf might not have all the animation inside its main timeline.
    Is there any way to achieve this goal?
    Thx

    Ok... Its as i thought... unfortunatly...
    Gonna mark your latest post again as possible solution, just in case someone comes with any sort of out of the box thing...
    Thx for your help Kglad

  • Creating New Menus that follow the playing of a movie clip

    I was wondering if it is possible to have iDVD display a new menu after playing a movie clip off of the first menu. Then from that second menu if it would then be possible to play a new movie clip.
    Essentially I want to create a progressive DVD where after each movie clip there is a new menu with new options. I just wanted to know if that was possible and if so, how I would go about accomplishing it.
    Thanks
    iMac   Mac OS X (10.4.5)  

    I don't think you can do it with iDVD. I wonder if you can even due it with more professional tools, but keep in mind that iDVD is meant as a simple consumer grade application to help people get their home movies on DVD. It is not really meant for anything more fancy than the basics to do what it does.
    My guess if your movie will end and either it defaults to the main menu or at best, the menu you entered the movie from. I don't think there is anyway to have a DVD player know where to go (somewhere different) at the end of a movie.
    Patrick

  • In iMovie '11 how do I slow down my credits at the end of my movie.  I typed them in, but the speed is too fast.

    I have iMovie '11, and I can't find how to slow down the "credits" I've typed in at the end of my movie.  I guess
    it would be the scrolling speed.

    Credits scroll at the speed that is necessary for the scrolling to complete by the end of the clip.  So, to slow them down, simply prolong the duration of the scrolling credits title clip by selecting and draggging out the yellow boundary.
    Geoff.

  • Adding a simple audio fade at the end of a movie - help

    Hi gentlemen,
    How do you add a simple fade out to the audio track at the end of a movie ?
    I tried adding a keyframe about 5 seconds before the end of my movie, but can't figure out how to do it. Not sure how to do this :-(
    I need some help. ( I read the manual and I don't get it )
    Thanks,
    Dave.

    Dave,
    In Effects>Audio Transitions>Crossfades, you should have 2 Trransitions. Choose Constant Power, and drag it to the end of your Audio Clip. Depending on your settings in Edit>Preferences, you may need to drag the beginning of the Constant Power Crossfade to the left, to get the 5 sec., that you want.
    Other method would be to highlight the Clip, and in the Effects Control panel, choose Volume. Go to 5 sec., before the end, and click the "stopwatch" to add a start Keyframes and add a Keyframe. Go to the end of the Clip and click the "add Keyframe" button. With the CTI still over that Keyframe on the end of the clip, drag the Volume slider to -00.0db.
    Hunt

  • Adding time at the end of a movie

    Is there a way to add a couple seconds of black at the end of a movie without having an object on the timeline?

    You could try extending the work area, but why not just put a black matte and do the job properly?
    If you play out the timeline to tape, a very short black clip at the end will generate permanent black output to tape, so you can avoid longer timelines that way if you wish. But exporting to file needs all frames to be specified.

  • Is there a way to detect the end of a video?

    Is there a way to detect the end of a video.. .mp4 or youtube? I want to be able to detect the end of a video and then have it do something...ie play on timeline or go to and play symbol.

    For youtube the code would be something like this:
    view-source:calkaweb.herobo.com/video.html
    for HTML5 videos for youtube replace &version=3 with &html5=1 in the youtube URL
    I have no idea how to impletent the youtube code into Edge tho other than an iframe but that wouldn't work I've tried :
    http://forums.adobe.com/thread/1285212
    You would need to place all of the youtube codes into edge in order for it to work but I duno how to do that and no1 answered the question in the thread I made about it.
    as for MP4/HTML5 video you can use
    var video = document.getElementsByTagName('video')[0];
        video.onended = function(e) {
          /*Do Something*/

  • I have FCE 4.0.1 and running OS x 10.7.5  when i burn my movie the audio from my movie clips don't come through .  My Sound effects and music can be heard.  I export to Quicktime movie, make it self contained then open IDVD for an intro and burn it.

    I have FCE 4.0.1 and running OS x 10.7.5  when i burn my movie the audio from my movie clips don't come through .  My Sound effects and music can be heard.  First I export to Quicktime movie, make it self contained then open IDVD for an intro and burn it.  everything sounds great in preview but then ( once again)I lose my audio from my movie clips.

    Try Mixing Down the audio before export.
    This info may help;
    https://discussions.apple.com/message/1060680?messageID=1060680&amp%3b#1060680
    Also serch this forum for Mix Down you should find lots of info.
    Al

  • How to detect the end of a loaded swf file

    Hello Guys
    This is my first time on this forum, come here with a great
    hope
    I have loaded a picture file (jpeg) and a video file (swf)
    into the main flash file using xml
    on frame 3, I load the picture and on frame 7, I load the
    video, there is a stop action on frame 6
    Now when the flash is executed the picture is displayed ( it
    says "Click here to view the video")
    when the user click the picture , the video is loaded and
    starts to play ---- so far everything is working fine
    now what I want to do is, once the video finishes playing (
    not stoped) I want to display the picture again
    can you tell me how to detect the end of an external loaded
    swf files,
    Please help me
    Thanking You
    Shriram

  • Detecting the end of an flv in ac 2

    I have a custom player i built. How do i detect the end of
    the flv so i can prompt an action, like go to another frame for
    instance or loop or call another flv. Have been struggling to find
    a solution online and keep hitting dead ends..
    Thanks in advance if someone can help... need this in
    actionscript 2

    unsure...
    I was just using keyframes on a timeline to play different
    flvplayers, brought in through import. I have used netstream
    successfully but i lose the player controls...

  • Detecting the end of an appendBytes NetStream

    Normally to detect the end of a NetStream, you can add a listener like this:
    myNetStream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
    and check for NetStatusEvents. If you're using appendBytes on your NetStream, it seems you don't get any useful NetStatusEvents aside from NetStream.Buffer.Full at the very beginning. Is there a way to know when the stream ends then? If you wanted to make something happen when it was over, would you just have to do it based on the duration of the stream?

    unsure...
    I was just using keyframes on a timeline to play different
    flvplayers, brought in through import. I have used netstream
    successfully but i lose the player controls...

  • Detect the end of flvplayback

    i have an flvplayback component on stage, named the instance flvPlayer and added this code to frame 1, so a video loads in it.
    flvPlayer.source = "clip1.flv";
    the videos plays from the local folder perfectly.
    I need a code that when the video ends, it jumps and stop to frame 1 of scene2.
    something like:
    scene 1, Frame 1:
    stop();
    flvPlayer.source = "clip1.flv";
    // code for detecting the end of the video and jumping
    when flvPlayer completed
        MovieClip(this.root).gotoAndStop(1, "Scene 2");

    i have "Scene 1" and "Scene 2".
    i have the flvPlayback component on the stage of scene 1. i chose flvPlayer for the instance name.
    and added this code to frame 1 of scene 1:
    stop();
    flvPlayer.source = "clip1.flv";
    flvPlayer.addEventListener(VideoEvent.COMPLETE, completeHandler);
    function completeHandler(event:VideoEvent):void
        MovieClip(this.root).gotoAndStop(1, "Scene 2");
    and i have scene 2 with a stop action on it's 1st frame.
    when i try to test the file, i get this error message in compile error section:

  • Making simple Cross desolves at the end of still photo clips from my library. Not making a clean disolve beteen. Single frames from the previous clip are flashing half way through the desolve. Did both a drag and drop and insert disolve.

    Making simple cross desolves at the end of still photo clips from my library.
    Not making a clean disolve between clips.
    Single frames from the previous clip are flashing half way through the desolve.
    Did both a drag and drop and insert disolve.

    Making simple cross desolves at the end of still photo clips from my library.
    Not making a clean disolve between clips.
    Single frames from the previous clip are flashing half way through the desolve.
    Did both a drag and drop and insert disolve.

  • How do I mute the sound on a movie clip that I'm using in iphoto slide show?

    I cant get rid of the sound on a movie clip I'm using in an iphoto slide show. I want to mute it as I'm using music on the slideshow. Thanks!

    Did your Mac come with iMovie preinstalled?
    Then you could export your video, import it to iMovie and remove the audio track. iMovie has two methods to silence a video clip - you can either select the clip in the project and use the command "Detach audio" or chance the audio settings of the clip and set the volume to zero. Then render the video new and import the silent version to iPhoto to use in the slideshow.
    Regards
    Léonie

Maybe you are looking for