XML Flash Slideshow v4 Help    |    Support Home    |    DWUser.com Home  Download Help PDF (29MB)    |    Search:

Using Slide-Based Events

Note:  This is an advanced topic only for users who are familar with XML and Actionscript editing.    Image events are explained in more detail in the com.dwuser.ss4.ui.IndividualSlide class in the API Reference.

Slide-based events are a set of special events which are dispatched by each slide.   Handlers for these events are added directly to the <img> node which represents each slide.    These events include:

  • The Sync Event - Handled via the event_sync XML attribute.
    Dispatched when the slide finishes transitioning in (opening) and is synced.  Referencing event.someValue in the handler allows for access to the original SlideshowEvent event properties, such as extraInfo (see SlideshowEvent.IMAGES_SYNCIMAGES in the API Reference for more info).  Referencing event.currentTarget.someValue is the same as referencing slideshow.someValue , since the SlideshowEvent is dispatched from the main slideshow.
     
  • The Click Event - Handled via the event_click XML attribute .
    Dispatched when the slide is clicked.  Referencing event.someValue in the handler allows for access to the original MouseEvent event properties.  Referencing event.currentTarget.someValue is the same as referencing currentSlideReference.someValue , since the MouseEvent is dispatched from the slide in question.  In other words, the event's currentTarget property provides a reference to the dispatching IndividualSlide instance.
     
  • The Roll-over Event - Handled via the event_rollOver XML attribute.
    Dispatched when the slide is moused over.  Referencing event.someValue in the handler allows for access to the original MouseEvent event properties.  Referencing event.currentTarget.someValue is the same as referencing currentSlideReference.someValue , since the MouseEvent is dispatched from the slide in question.  In other words, the event's currentTarget property provides a reference to the dispatching IndividualSlide instance.
     
  • The Roll-out event - Handled via the event_rollOut XML attribute.
    Dispatched when the user mouses off the slide.  Referencing event.someValue in the handler allows for access to the original MouseEvent event properties.  Referencing event.currentTarget.someValue is the same as referencing currentSlideReference.someValue, since the MouseEvent is dispatched from the slide in question.  In other words, the event's currentTarget property provides a reference to the dispatching IndividualSlide instance.
     

Handlers added for any of these events will be called when the corresponding event occurs.    This allows you to dispatch a global event or perform some other task when a local slide event occurs.    As mentioned above, the handlers are added directly to the <img> node which represents each slide.  It is best to illustrate this with some example code:

Example Handler 1 - The following listener starts autoplay when the image is opened / synced:

<img ... event_sync="event.currentTarget.startAutoplay();" />

Example Handler 2 - The following listener calls the javascript alert function (which displays an alert box) when the slide is rolled over:

<img ... event_rollOver="navigateToURL(new URLRequest('javascript:alert(\'You just rolled over the slide!\')'));" />

The most common use (as shown above) is to start autoplay when a specific image is opened.    As a more complex example, you might fade out another portion of the slideshow UI when the user hovers over an image, then restore it when the hover out.    These events are especially helpful when integrating a slideshow in a custom Flash or Flex project.