3 Replies Latest reply on Jul 28, 2010 7:57 AM by rexdtripod

    Timeline in Flex?

    rexdtripod Level 1

      I'm looking to develop a component that takes in xml data listing events and times (things like advance slide at 8 seconds, or display a custom polling component to the user at 52 seconds), and broadcasts events based on the data.

       

      I see cuepoints discussions around but they seem, generally, to be injected into video.  The points I'm looking to react to are in an xml file though and not a video.

       

      Can anyone who may have crossed this bridge spare some tips or direction in this regard?

       

      Thanks

        • 1. Re: Timeline in Flex?
          Adam York Level 1

          Anything that extends UIComponent can have children added to it. If you were to add for example a sprite , a sprite being a DisplayObject but without the mx wrappers around it would have it's enterframe event exposed. You could simply add a listener for this event to the object that calls some sort of global time keeping function. Then just base the xml "cue point" time off the elapsed time from when you added the sprite to the stage and entered frame. Alternatively you could just create a timer utility that starts on creation complete , or application complete of the component, assuming the xml has already been loaded and parsed at this point you could easily set up a differed list of events that will occur in some factor of elapsed time.

           

          Message was edited by: adam york , for clarity

          1 person found this helpful
          • 2. Re: Timeline in Flex?
            rtalton Level 4

            If you only have a handful of these events in your XML file, you could simply create a separate Timer for each individual XML item. An event listener for each Timer's timerComplete event could then trigger an action.

             

            If you need to display the overall progress of these events to the user, you could use a HSlider which updates its thumb position in response to the individual Timer events, or to a "master" Timer running just for this purpose.

            1 person found this helpful
            • 3. Re: Timeline in Flex?
              rexdtripod Level 1

              These responses have helped me move towards a first attempt at modeling this.  I'll lay it out here and ask that you critique it.  Here goes:

               

              What I'm really trying to do is develop a system for archiving a presentation (virtual meeting).  At first glance it seems to me that an archive is simply an xml file containing the commands that were executed during the original meeting.  Maybe it goes something like this:

               

              At the press of a "record" button, begin recording commands to an xml file.  Then, at the press of a "stop recording" button, stop recording commands to the file.

               

              Some sample commands would be things like:

               

              0.05 Display view state #1 (large slide show, small video)

               

              0.08 Advance slide show to slide #2

               

              0.15 Start video

               

              0.36 Advance slide show to slide #3

               

              0.52 Stop video

               

              0.52 Change display to view state #2 (Hide video, shrink slide show, and display polling widget)

               

              And so on...

               

              After the archive is created, viewing it might go something like this:

               

              The viewing application must ingest the xml file containing the events, create an array of events, and compare the times for each to the current time.  Where current time matches an event time, events get dispatched and handled.

               

              Solution:

               

              1.  On starting the program that plays the archive, ingest the xml event file and create an array of events

               

              2.  Create a clock (or stopwatch) class 

               

              3.  On press record, start the clock

               

              4.  Every second, compare the time of the next event to the current time.

               

              5.  If they don't match, do nothing

               

              6.  If they match, dispatch an event and have the app handle the event

               

              This is probably not the best way to handle this.  But it's a jumping off point.  Critiques welcome.