how to detect when movie is done without fla file? #18

Closed
cy-zhang-yekai opened this Issue Jun 11, 2013 · 8 comments

Projects

None yet

3 participants

@cy-zhang-yekai

i cant edit fla file ...so plz tell me another way to detect the movie done...

@splhack
Contributor
splhack commented Jun 11, 2013

How about this?

lwfObject.AddMovieEventHandler(/* movie instance name */ "foo", enterFrame:(movie) => {
    if (movie.currentFrame == movie.totalFrames || !movie.playing) {
        UnityEngine.Debug.Log(movie.GetFullName() + ": done");
    }
});
@cy-zhang-yekai

thax,but in my case have err...can you tell me more detail.

@cy-zhang-yekai

void Start()
{
string dir = string.Format("{0}/", file_name);
string path = dir + file_name;
Load(path:path, texturePrefix:dir);
attached_movie = lwf.rootMovie.AttachMovie("test","test");
AddMovieEventHandler("test", enterFrame:(movie) => {
UnityEngine.Debug.Log("test");
});
}

IT's not err but Console display nothing...AddMovieEventHandler not work....i think..

@splhack
Contributor
splhack commented Jun 12, 2013

Could you use the latest version of lwf (222ad0e)? Older versions might have such kind of bugs.

@cy-zhang-yekai

i think i used lastest version lwf for unity....

@HiroyukiHaga
Contributor

I've updated one of the lwf demo projects to demonstrate splhack's solution.
Please take a look following example.

Source

Build

LWF.Movie attached_movie = 
    lwf.rootMovie.AttachMovie(
        linkage_name, // Symbol's linkage name in library
        instance_name,  // Attached movie name.
        enterFrame: enterFrameCallback // Callback that called every frame.
    );
void enterFrameCallback( LWF.Movie movie )
{
    if (movie.currentFrame == movie.totalFrames
        || !movie.playing) {

        message += movie.GetFullName() + " is done \n";
        lwf.rootMovie.DetachMovie( movie );
    }
}

13 06 13 18 38

@cy-zhang-yekai

thank you so much.it works!^^

@HiroyukiHaga
Contributor

I'm happy to hear that.
Closed.

@watilde watilde pushed a commit to watilde/lwf-demo that referenced this issue Jan 29, 2014
Hiroyuki Haga build is updated to demonstrate solution at gree/lwf#18 8acbe97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment