Forums

AnythingSlider – Restart flash movie on show

Hello,
I’m using AnythingSlider to show various flash movies and it’s working a treat. The only downside is that every flash movie has it’s own duration and the latest version of AnythingSlider has a global timeout for all slides. Besides that, IE starts playing all the movies on load. So, if I have a 10 sec movie as the 1st slide and a 15 sec movie as the 2nd slide, when the slider transitions from the slide 1 to slide 2, slide 2 will still be 5 sec from its end. The solution would be to use JS to interact with flash and restart the movie when the slide is rendered to view. I know how to do it but cannot figure how to refer to the flash object from AnythingSlider. I am pretty sure I’ll have to use the onSlideComplete event handler for that. Here are some code snippets to help you understand:

The “Flash Interaction” code above must be adapted inside the onSlideComplete event handler. This is where I got stuck. How can I access the Name or ID properties of the Object tag inside the slider LI tag or of the Embed tag inside the Object tag (in IE)?

Can anyone help me rewrite the flash interaction code so I can use it with AnythingSlider?

If I can bother you with another question, the previous version of AnythingSlider I was using allowed to set the timeout individually for each slide by setting the ID property of the LI tag containing the slide to the desired timeout value. So if the first LI had ID=”10000″ it would have a timeout of 10sec, and if the second slide had ID=”25000″ it would have its timeout set to 25sec. That version didn’t allow me to use the event handlers (onSlideBegin and onSlideComplete) to interact with the flash movies, so I upgraded to the latest version which on its turn fixes a global timeout for all slides at one. The question is: is there a way I can set the timeout individually to each slide as I could before?

Hey, this is a fantastic tip (restarting flash) and just to give a little back, I had to adapt this code a bit to work with mixed content (flash and images) so to make sure it worked with an image without an undefined error I had to check if the flash objects were in fact flash objects:

Tips

Categories

We have a pretty good* newsletter.

Email Address

CSS-Tricks* is created, written by, and maintained by Chris Coyier and a team of swell people. It is built on WordPress, hosted by Media Temple, and the assets are served by MaxCDN. The fonts are Source Sans Pro and Source Code Pro. It is made possible through sponsorships from products and services we like.