Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Computer Technical Help
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2007, 07:51 PM
ballahollaSHIPIT ballahollaSHIPIT is offline
Junior Member
 
Join Date: Mar 2007
Posts: 5
Default 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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:46 PM.


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