Simple Play/Restart Button (CS4, AS3)
Hey Everybody,
I am working on an INCREDIBLY simple flash video display in CS4 with AS3. I have a 6-second video clip with no sound. The only control I want on it is a "replay" button. The video instance name is "lakerise" and the button name is "playbtn". The code is below.
I am wondering if the problem here is something not in the script itself (like button properties?), but I'm not really sure. I set the "autoplay" property for the video to "true," so the movie plays once and the button shows up, but then is unresponsive. The mouse changes to the hand over the button, so it seems to recognize the symbol. At this point, I get no compiler errors.
Other things I have tried were:
*adding an event listener to stop or pause the video after it finishes
*starting the code with stop();
*removing one or two of the commands in the repeat function in various combinations (just doing "seek(0)" or just doing "play()"
Let me know if you have any ideas about how to fix this! Also, I apologize if I made any forum faux pas. Thanks!
import fl.video.*;
var lakerise:FLVPlayback = new FLVPlayback();
var playbtn:SimpleButton = new SimpleButton();
playbtn.addEventListener(MouseEvent.CLICK, repeat);
function repeat(event:MouseEvent):void {
lakerise.pause();
lakerise.seek(0);
lakerise.play();
}
