PDA

View Full Version : Featured Content Slider- activate Flash movie



mike_c
05-14-2008, 09:29 PM
1) Script Title: Featured Content Slider v2.0

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm

3) Describe problem:
First off: Thank you for your work on this script!

I am trying to use the script to slide through several Flash movies. The problem is once the movie is done playing, and the cycle loops through, it doesn't restart playing the movie, but stays at the end frame. I've tried this with inline movies, using iframes, and using an external file with ajax.

I have a script where I can use a onclick:PlayFlashMovie(); to start the flash movie, but I don't know how to integrate this with the contentslider.js. My first thought was to stick the command into the "onChange: function" section, but that didn't seem to work... (or maybe I didn't do it right) My feeling is it needs to be integrated with the pagination, but how this is done I don't know.

Any help would be greatly appreciated!

ddadmin
05-15-2008, 07:55 AM
While I'm not familiar with calling/stopping Flash movies on demand, as long as you have a way to explicitly restart a Flash movie via some function (ie: playFlashMovie(number)), you should be able to use that in conjunction with the Slider script's onChange event handler to restart a movie when it is shown as the Slider script shows the slide in question. Something like:


onChange: function(previndex, curindex){ //event handler fired whenever script changes slide
playFlashMovie(curindex)
}

Now, I don't know how playFlashMovie() is actually called to tell it to start a particular Flash movie versus another, so the above is just the general concept.

mike_c
05-15-2008, 04:54 PM
Thanks for your reply, I'm very basic with Javascript, but this is the script I have, that I'm trying to use with the slider:


<script language="JavaScript">
<!--
// (C) F. Permadi
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}

function PlayFlashMovie()
{
var flashMovie=getFlashMovieObject("aniflash3");
flashMovie.Play();
}
//-->
</script>

It does work with:

<input type="button" value="Play" name="Play" onClick="PlayFlashMovie();">

but when I try to insert the "PlayFlashMovie(); into the onchange, it doesn't work.

I appreciate your help, please let me know if you can think of any other solution!

ddadmin
05-15-2008, 07:49 PM
I haven't worked with manipulating Flash using JavaScript. Can you put up a test page that includes:

1) The Flash movie, and the sample form button above that plays it whenever clicked on
2) Featured Content Slider with the same movie embedded, plus your attempt of using the onChange event to play the movie when the user goes to that slide?

mike_c
05-16-2008, 12:43 AM
Ok, sorry for the delay. Here's the link:

http://www.springthunder.com/test.html

After more experimenting I've almost got it to work. It is restarting the movie, but on every onchange, instead of just when it gets to the third slide.

Any suggestions much appreciated! :)

ddadmin
05-16-2008, 06:54 AM
That's easy to fix. If you want to call flashMovie.play() only when the 3rd slide is shown, you'd do something like:


onChange: function(previndex, curindex){
var flashMovie=getFlashMovieObject("aniflash");
if (curindex==3) //if this is the 3rd slide being shown
flashMovie.Play();
}

mike_c
05-16-2008, 11:33 PM
You're awesome dude! Thanks for the help, worked like a charm!

g_force
08-31-2008, 11:29 AM
I am looking to do a similar thing to mike_c (i.e. trigger a flash animation outside of flash but jumping to different frames) so I thought the content slider would be ideal for this (nice work by the way!). But really - there are two real subjects that I need to uncover.

1) Firstly: where should I input the flash file? And from there how do I get it to jump to various frames of my animation?

2) For a separate project I would like to ask what I can do to change the menu 'page' section at the bottom of the slider as I am looking for a similar feature whereby the menu of the page/screen selected is highlighted but I would like to use my own images and change one image for another when selected.

As you can probably tell I am a complete JS novice and really appreciate any answers/suggestions anyone can donate.

Thanks kindly>

g_force
09-11-2008, 02:44 PM
Can you take a look at this:

Test Page (http://webvertising4free.com/MFPOI/TESTS/dynamic_TEST1.html)

This doesn't appear to work in IE (at least version 7.0), how can I get around this?

ddadmin
09-13-2008, 06:02 AM
There's an error with one of the other scripts on the same page:


Error: syntax error
Source File: http://webvertising4free.com/MFPOI/TESTS/dynamic_TEST1.html
Line: 1, Column: 71
Source Code:
MM_preloadImages('bluesquare.jpg','redsquare.jpg', 'yellowsquare.jpg', )

Try removing all scripts on the page except the Featured Content Slider, and see if that fixes things in IE.

g_force
09-15-2008, 08:57 AM
Thanks - I've resolved it

Don't know how to give thanks but I do.