#1
|
|||
|
|||
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. |
|
|