PDA

View Full Version : I need Flash scripting help.



Jagella
02-02-2009, 05:52 PM
I'm working on a Flash CS3 animation. I've added a Play button and a Stop button to play and stop the animation, naturally. I've also coded some Action Script 3.0 to enable these buttons to control the animation. Everything works except for one problem: I want the animation to be initially still. As is, the animation is initially moving. How can I code the script to have the animation initially stopped and only starts playing when the Play button is clicked?

Here's the code:


//Controlling a movie clip with a button
stop();
//code-hint comments
//SimpleButton stopBtn;
//SimpleButton playBtn;
//event handler
function handleClick( pEvent:MouseEvent ):void
{
if( pEvent.target == stopBtn )
{
//handle event
animMc.stop();
}
if( pEvent.target == playBtn )
{
//handle event
animMc.play();
}
}
//register events
stopBtn.addEventListener( MouseEvent.CLICK, handleClick );
playBtn.addEventListener( MouseEvent.CLICK, handleClick );

vangogh
02-02-2009, 09:01 PM
I don't know much ActionScript, but I think it's something like autoload=false. Try searching for "flash autoload" or something similar. I'm pretty sure it's something like that controlling when the file starts.