Two Plus Two Newer Archives

Two Plus Two Newer Archives (http://archives1.twoplustwo.com/index.php)
-   Computer Technical Help (http://archives1.twoplustwo.com/forumdisplay.php?f=50)
-   -   flash9 actionscript 2 hittest and play sound (http://archives1.twoplustwo.com/showthread.php?t=555849)

ballahollaSHIPIT 11-27-2007 07:51 PM

flash9 actionscript 2 hittest and play sound
 
Hi there. I'm an uber n00br and was making a little music generator.

I've never taken a flash class and am doing this for fun, however it isn't very fun anymore.

loaded in my library I have boing2, ball1, top, bottom, left, and right.

they have all been converted to movie clips (except the sound). The ball bounces around the box, hitting the walls (either, left,right,top,or bottom) and I want the ball to play a sound when the hittest returns true. Here is the script I have assigned to the ball hoping that when it hits the wall a sound plays.


onClipEvent (load){
boing2Sound = new Sound();
boing2Sound.attachSound("boing2");
xspeed=8;
yspeed=6;


}
onClipEvent (enterFrame) {
if (_root.ball1.hitTest(_root.top) == true) {

}
boing2Sound.start();
}

onClipEvent (enterFrame) {
_x=_x+xspeed;
_y=_y+yspeed;
if (_x>350 or _x<0) {
xspeed=-xspeed;

}

if (_y>350 or _y<0) {
yspeed=-yspeed;
}


}


I know this is only being applied to if the ball hits the "top" movie clip, however nothing plays.

I'm getting very frustrated, and any help would be great.


All times are GMT -4. The time now is 01:20 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.