3 Replies Latest reply on Nov 6, 2008 9:57 AM by Gregory Lafrance

    VideoDisplay communication problem

    John Hall Level 4
      I have a videoDisplay component defined in MXML with an id of myPlayer. I also have actionScript that refers to that component. The AS is triggered by an event somewhere else in the program. When I debug the following simple case, it says that myPlayer is null, though it's in the same component and the string Alerts fine. What simple principle am I missing?

      If I create a button with a function to play a clip, it works fine. So I suspect it's something to do with the event. Suggestions

        • 1. Re: VideoDisplay communication problem
          Gregory Lafrance Level 6
          What event is dispatched? What component, or the main app, dispatches the event?

          This is the closest I can get to trying to guess how to reproduce the problem, and in this case it is because with the preinitialize event myPlayer does not yet exist.
          • 2. Re: VideoDisplay communication problem
            John Hall Level 4
            Thanks for taking the time to try to repro it. And you're right, that it exhibits the same message. The problem is that the app is well instantiated (nothing happens until a message is sent for applicationComplete) and the component in which the display is in has a creationPolicy of "all" ... so I'm stumped. However, your repro DOES suggest that somehow the player isn't instantiated yet. However, if I do a simple button that calls the function at the bottom of this message, all works fine.

            As far as the event, I'm using the Mate framework .. if you're familiar with it, the action is pretty simple and as I mentioned it Alerts what I would expect in the function:

            <!-- Play Video-->
            <EventHandlers type="{AppEvent.PLAY_VIDEO}">
            <MethodInvoker generator="{videoComponent}" method="playVideo" arguments="{event.clip}"/>
            </EventHandlers>
            • 3. Re: VideoDisplay communication problem
              Gregory Lafrance Level 6
              I'm not familiar with Mate. If it were possible to boil this case to a more complete test app so we can see the complete flow of the event that would be best, though I know sometimes that is difficult.