Results 1 to 7 of 7

Thread: Problems with multiple sounds

  1. #1

    Problems with multiple sounds

    I'm using the AS3 iOS mode in CS5. It seems like playing sound fx on the timeline is unreliable. I've set all my sound to stream, which I've been told works, if they're all set to the same (not event). I get this when I export:

    SWF contains multiple copies of a sound item

    I've started to play internal sounds from the library, but this also seems to have problems if I want to repeat the same sound clip on different frames of a timeline.

    Can anyone advise what to do about this? I don't know if it's a bug, or my own inexperience! Sometimes when I delete code with sound in, the error still stays!

    I'd just like to know best practice. Thanks

  2. #2

    Playing sounds on different frames

    Ok, so here's a really simple thing I'm trying to do in AS3, which isn't happening. Surely this is straightforward?!

    Tutorials rarely mention what to do about putting code on different frames.

    All I want to do is set up a new sound with linkage "PopSound", and play it many times on different frames on the timeline.

    Frame one of my timeline has this code:

    Code:
    var mysound:PopSound = new PopSound();
    var channel:SoundChannel = mysound.play;
    So if I want to play that sound again on other frames, I assumed the code would be:

    Code:
    var channel:SoundChannel = mysound.play;
    but this creates an error. Any ideas Please?

  3. #3
    ah come on, this has got to be a simple answer.. someone please put me out of my misery!

  4. #4

    Repeated Sound is working!

    Cracked it! I found a great tutorial. This guy's code is written slightly differently to the books:

    http://www.8bitrocket.com/2008/5/23/...sounds-in-AS3/

    Here's how to set up the first sound on frame 1 of your timeline. My linkage is "Chipsound"

    Code:
    var mySFX:Chipsound;
    var mySFXChannel:SoundChannel;
    
    mySFX=new Chipsound();
    mySFXChannel=mySFX.play;
    And then you can add this line to new frames to play the same sound:

    Code:
    mySFXChannel=mySFX.play;
    I now realize that there loads of ways to skin a cat in AS3. I'm just trying to find the code that works!

  5. #5
    Shouldn't you also include the brackets at the end:
    mySFXChannel=mySFX.play();
    2006-11 GlosRFC - Searching 8,168,684,336 brain cells

  6. #6
    Yes you should, which is what differentiates a function from a property or getter/setter.

    Unless that "play" IS a getter, but that wouldn't make much sense, as it's being treated like the sound play function.

    Also, my advice to you is stop using the timeline alltogether and just manage everything with custom classes. Once you get used to it it's so much cleaner and easier to manage.

  7. #7
    I agree with rumblesushi, try your best to avoid anything code or sounds on the timeline. If you navigate and play with the timeline threw classes, you have much better control. I do believe that 'play' is a setter, of coarse i have nothing to back myself up on that, just from experiance.
    Become a Pro -IronCoding.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012