A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Adding Sound to Bouncing Ball

  1. #1
    Senior Member
    Join Date
    Jan 2008
    Posts
    107

    Question Adding Sound to Bouncing Ball

    Hi. So here's the deal. I have a as 3.0 .fla where a ball is just roaming around hitting walls and I would like to play a sound each time the ball hits one of the stage's wall, just like this.

    I have this on my file:
    Code:
    var snd:Sound = new Sound(new URLRequest("TennisBall.wav"));
    And on each if (when the ball hits one wall and changes it's course) I have:

    snd.play();
    Each time I run the game, I get no sound and the following error message:

    Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
    at game_fla::MainTimeline/game_fla::frame1()
    ArgumentError: Error #2068: Invalid sound.
    at flash.media::Sound/play()
    at game_fla::MainTimeline/moveBall()
    What am I doing wrong here? All the code is placed on the first frame in the timeline.

    Thanks.
    Last edited by Hurdarr; 05-23-2009 at 02:09 PM.

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    are you certain you can load an external wav file? I havent tested this lately, but older versions of flash only supported external mp3 not wav.

  3. #3
    Senior Member
    Join Date
    Jan 2008
    Posts
    107
    Not sure what you mean as I started messing around with flash. I´m using flash cs3.

  4. #4
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    try loading mp3 instead of wav

  5. #5
    Senior Member
    Join Date
    Jan 2008
    Posts
    107
    How do I do that? Is my previous code correct?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center