Jump to content


play, stop, link and code


  • You cannot reply to this topic
4 replies to this topic

#1 rellac

    Young Padawan

  • Members
  • Pip
  • 16 posts

Posted 06 July 2007 - 11:02 AM

ok, so i just want to know, how do I add a play button at the beggining of my flash animation, how do I stop it from looping, how do i create a hyperlink at the end and how do I get the correct source code? I tried opening it in internet explorer but the code didn't work when I put it on my site, www.dannycaller.tk :bashhead:

#2 Hoot

    * Hooty Tooty Fruit *

  • Members
  • PipPipPipPip
  • 1,346 posts
  • Gender:Male
  • Location:Canada
  • Interests:Making Websites, Working in 3D, Playing the Drums

Posted 14 July 2007 - 09:55 AM

I will have to look into the play button one since it is a little (not much) technical then the stop, for the stop button you would simply select the stop button and then in the action script add:
stop();
and it should stop what you are trying to stop. I will look into the play one since I haven't used flash in some time.

Hoot

#3 rellac

    Young Padawan

  • Members
  • Pip
  • 16 posts

Posted 15 July 2007 - 08:53 AM

View PostHoot, on Jul 14 2007, 09:55 AM, said:

I will have to look into the play button one since it is a little (not much) technical then the stop, for the stop button you would simply select the stop button and then in the action script add:
stop();
and it should stop what you are trying to stop. I will look into the play one since I haven't used flash in some time.Hoot
thanks alot, but i don't want a stop button, i want the movie to autmaticly stop at the end :angrylooking:oh, and I got a play button from newgrounds :D :P But it says that my actionscript doesn't support the movie code, how do I download the newer version?

#4 Tirus

    P2L Jedi

  • Members
  • PipPipPip
  • 764 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design, Programming, Music, Martial Arts

Posted 15 July 2007 - 09:24 AM

to create a play button, you first need to put the actionscript
stop();
on your first frame, this way the movie does not automatically start. (If you want the user to press play when no part of the movie is showing at all, insert a new frame at frame 1 so that the play button will be on a blank screen.)

On this first frame, which you have put the stop coding on, create a movieclip or a button (movieclips are more commonly used today, even as buttons) which will be your Play button. Use this actionscript for that movieclip/button:

on(release) {
	_root.play();

}


I know that code will work on a movieclip, if it doesnt on a button, just remove _root.

As for stopping the movie from looping, simply put
stop();
on your last frame.


If you want to create a hyperlink, use this code:
on(release) {
	getURL("http://www.website.com", "_blank");
}

Of course, you can choose _blank, _parent, _self etc.

#5 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 15 July 2007 - 08:51 PM

What version of Flash are you using? If its Flash CS3, you'll have to set your Actionscript settings to 2.0. Also, I suggest you use:
this.onRelease = function(){

}

Rather than:

on(release){

}

For the functions noted above. The on() and onClipEvent() methods shouldn't be used much anymore. Unfortunately most tutorials still teach people to use them, even though they have been replaced by much more useful methods that promote better coding practices.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users