• Home
  • Free Tutorials
  • Free Video Tutorials
Your Ad Here
Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Ping Pong - Sound Menu

Category : Flash Views : 30755
Version : 8 Rating : 
3.2/5 (47 votes)
  • Currently 3.23/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: ping-pong-sound-menu.zip
Result: See the result


<<< PreviousIndex Series

Previous | 1 | 2 | Next

Now go to the actions for the ball and make these changes:
if (_root.Limits.Border.hitTest(this._x + xspeed, this._y + yspeed, true)) { xspeed = -xspeed; xspeed *= 1.05; yspeed *= 1.05; //create a new sound object var pong:Sound = new Sound(); //attach the sound from the library using the identifier pong.attachSound("Pong"); //start playing the sound pong.start(); } if (_root.Limits.Pads.hitTest(this._x + xspeed, this._y + yspeed, true)) { yspeed = -yspeed; xspeed *= 1.05; yspeed *= 1.05; //same as above var pong = new Sound(); pong.attachSound("Pong"); pong.start(); }

Code Explanation

PlayBtn.onRelease = function() { _root.gotoAndStop(2); }
When the user clicks the "Play" button we go to the frame 2 of the game using the "gotoAndStop(frame)" function.

MenuBtn.onRelease = function() { _root.gotoAndStop(1); _root.Scroll.removeMovieClip(); }
Here, we go to the first frame and remove the "Scroll" Movie Clip.

var pong = new Sound(); pong.attachSound("Pong"); pong.start();
On the first line of this code we create a new Sound object, then we use the function attachSound(identifier) to attach the sound we have on our library. And on the last line we call start() to start playing the sound effect.

That's all for this game, test it with Ctrl + Enter. I hope you like this flash game development. See you in the next game!


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | Next

<<< PreviousIndex Series
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement







Your Ad Here

Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.