Skip to content

Getting LWF.Bounds of a LWF.Movie immediately #144

Open

Description

@DelSystem32

Right now it seems like the only way to get the bounds of a LWF.Movie is to do this:

private LWF.Bounds theBounds;
private void BoundsFetcher(LWF.Movie m) {
    theBounds = m.GetBounds();
}
public LWF.Bounds GetBounds (string mcInstanceName = null) {
    lwf.SearchMovieInstance ("instancename").RequestCalculateBounds(BoundsFetcher);
    lwf.Exec (-1);
    return theBounds;
}

However this means you have to update the flash once. Is there a better way to do it, without using RequestCalculateBounds()?

Or using RequestCalculateBounds() but not having to call Exec(-1)?

Edit: Changed the incorrect 0 to the correct -1.

Activity

  1. DelSystem32 commented on Oct 9, 2015

    @DelSystem32
    ContributorAuthor

    A workaround would be to avoid calling Exec() and simply have LWF RequestCalculateBounds() after every single update that it does, on all its LWF.Movies. However then I ask how can I loop through all LWF.Movies in a LWFObject? I know about lwf.buttonHead to loop through all buttons however there isn't anything similar for movies or is there?

    Edit: That workaround is no good since if a script repositions a MovieClip within the flash and then tries to get the bounds then the bounds will not have been updated to the changes. Seems like I need to call Exec(), meaning I will need to workaround the problem with any false enterFrame MovieEvents that might come out of the extra Exec() call. Note to anyone reading this: -1 should be given to Exec(), not 0.

    Leaving question open since it would still be good to know if there is a way to get the bounds of a MovieClip without having to call Exec()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions