Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the flash with a delta time of 0 still calls OnEnterFrame #145

Open
DelSystem32 opened this issue Oct 9, 2015 · 0 comments
Open

Comments

@DelSystem32
Copy link
Contributor

I have this code:

lwf.AddMovieEventHandler(lwf.rootMovie.instanceId, enterFrame:MyHandler);

void MyHandler(LWF.Movie m) {
    Debug.Log("hello");
}

If I call:

lwf.Exec (0);
lwf.Exec (0);

Or:

lwf.UpdateLWF(0);
lwf.UpdateLWF(0);

I still get "hello" printed out several times, even though there has been 0 milliseconds since the last time the method was called, which is not enough time to enter another frame. This can't be intended behavior, right?

Actually, if I run this code...

int id = lwf.AddMovieEventHandler(lwf.rootMovie.instanceId, enterFrame:MyHandler);
UpdateLWF(0);
lwf.RemoveMovieEventHandler(lwf.rootMovie.instanceId, id);

...then "hello" is printed out three times, just from that single UpdateLWF()! Even though it is only called once between adding and removing the handler and the tick is zero time.

Edit: Seems like Exec() wants -1 where UpdateLWF() wants 0. UpdateLWF calls Exec and if UpdateLWF received 0 as tick it will change tick to -1 for Exec. Kinda confusing, especially since the suggested value for the optional parameter "tick" in Exec is set to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant