Load another sound in the same sound object

Hi,
I am loading a sound like this:
public var smallSound:Sound = new Sound();
public var trans1:SoundTransform = new SoundTransform(1, 0);
public var channel:SoundChannel = new SoundChannel();
smallSound.load(new URLRequest("firsttrack.mp3"));
channel=smallSound.play(0,1,trans1);
When an event occurs (button click actually) I would like to stop playing the first sound and playing another sound in the same object. So I try doing this:
smallSound.load(new URLRequest("secondtrack.mp3"));
channel=smallSound.play(0,1,trans1);
but it does not work. The first sound keeps playing. I havent understood something probably.. Can someone help me ??

ok, i solved my problem. It works like:
channel.stop();
smallSound = new Sound;
smallSound.load(new URLRequest("secondtrack.mp3"));
channel = new SoundChannel;
channel=smallSound.play(0,1,trans1);

Similar Messages

  • How can I use the same Sound variable for multiple sounds?

    I need my program to play many different mp3 files at different times.  I'm reading that you can not load different mp3 files into the same Sound variable.  But there must be a way around this right?  Can I Unload mp3 files some how?  Or can I delete the Sound variable and declare it again?  I don't want to have hundreds of Sound variables so what do I do?  Thank you.

    delete doesn't work in as3.  you must remove all listeners and references including nulling the variables.  for displayobjects, they need to be removed from the display list.
    p.s.  you don't need to create a sound instance until you need to load an mp3 using one.  so, if you're waiting for user input to start loading an mp3, you should wait for that input to create that sound instance.

  • OSS doesn't play more than 1 sound at the same time [SOLVED]

    Hello,
    I use OSS to replace ALSA, it used to work properly here. Today I noticed that I can't play more than one sound at the same time, something which I used to be able to do.
    Also, ossxmix doesn't operate properly (I can't control the volume of a specific program).
    Looks like a permissions issue, because /dev/dsp and /dev/oss are created as root and other users get Permission Denied.
    Any ideas how to fix it? My sound card is an AC'97 onboard.
    Thanks!
    EDIT: Solved by pacman -R oss, rm -rf /usr/lib/oss then pacman -S oss. Seems to have worked.
    Last edited by Renan Birck (2009-01-02 23:06:35)

    Hello Angela,
    Have you tried resetting the iPod yet to see if that makes a difference?  To do this, press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear.
    If that doesn't work, a restore of the iPod via iTunes may be in order.
    B-rock

  • What is wrong with my headphone jack? i have an ipod touch 4th generation ipod touch every pair of headphones and earbuds i plug in it has the same sound going to both sides.

    what is wrong with my headphone jack? i have an ipod touch 4th generation ipod touch every pair of headphones and earbuds i plug in it has the same sound going to both sides.

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so.
    Try the following to rule out a software problem
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself
    iPod Touch Repair – iFixit

  • Can't we listen to 48KHZ and 96 KHZ sounds at the same time?

    I have bought E-mu 1212M card. My problem is : I cannot listen to windows sounds or any sound file at 48KHZ when I am at other internal frequencies.
    Forexample , when I switch to 96KHZ with Patchmix dsp all the sounds of windows ( media players, applications...) muted and I can only hear 96KHZ applications. So I can use DAW programs at 96KHZ but cannot use other programs to listen to sound files which are usually 44.1 or 48KHZ. I cannot choose them to integrate DAW because of silence.
    I want to hear all the sound at the same time. I could do this with my all sound card before. Why can't I use all the sort of sounds ?

    Select the music play list you want to listen to and start it playing. Go back to the home screen and start the app you want to use, music will stop. Press the home button two time quickly and it will bring up a simple control for controling the music. This works for me with all of the apps I have purchased including games. Just a note you can pull up the same music control if the iPod is a sleep and locked by pressing the button three times quickly.
    Mike

  • Firefox and ut2004 sounds at the same time

    I can't hear ut2004's sounds when firefox is running.
    I found out it is happening because /dev/dsp is busy (im using alsa).
    Is there anyway to hear sounds from both apps at the same time?
    (I have read that there is a way to have multiple apps use sounds on the same machine, but I have no idea how to do this)
    Sorry for my English.
    Thanks.
    Last edited by DarkLikeHell (2009-07-20 15:12:32)

    Strange... the only problem I've had with sounds is when one program is using oss, and the rest are silent. If you're using alsa, you can work around the issue by installing alsa-oss, and starting the oss program with alsa-oss "pathtoexecutible"
    someone correct me if i'm wrong

  • Pavilion g 7, speakers and headphones playing sound at the same time

    hello. My speakers and headphones are playing sound at the same time. It happened suddenly? Any help

    Hi,
    Can you post back with the following details.
    1.  The full Model No. and Product No. of your g7 series notebook - see Here for a guide on locating this information.
    2.  The full version of the operating system you are using ( ie Windows 7 64bit ).
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • How can I copy an audio effect from a clip and paste it to another clip in the same timiline...With FCPro 7 it was all so fast........

    how can I copy an audio effect from a clip and paste it to another clip in the same timiline...With FCPro 7 it was all so fast........

    Tom Wolsky wrote:
    The advantage goes to FCP7 if you allow that it can copy and paste filters, audio and video, transformations, and other attributes separately.
    You can do that in FCPX too, as all the things you cited are listed separately in the inspector.
    Here's a little gotcha. Let's say you've color corrected a few clips and you've applied an effect to one and want to paste it the other clips. You switch off color correction and copy the clip. You select the other clips and paste effects. What do you think happens? The effect is applied, but the color correction is applied as well, only it's switched off as it was in the first clip, so all the color correction on the other clips is lost. Fun, eh?
    I'll try to replicate your gotcha - but no, that doesn't sound like fun at all!

  • Clicking noise coming form my new 27" iMac custom order (loaded machine) anybody having the same problem I mean this unit is a day old.

    clicking noise coming form my new 27" iMac custom order (loaded machine) anybody having the same problem?
    I mean this unit is a day old.

    Hey lawrencefromsaskatoon,
    Sounds like a HD issue. Take into an Apple retail store.
    -Aleks

  • How do I move i-tunes from one Hard Drive to another HD on the same computer.

    What is the easy way to do this. I am over my capacity and I have installed another HD on the same computer.
    I want everything relate to i-tunes and back-ups to be on the new hard drive.
    Please help.

    Load the library which doesn't contain the songs and drag them into the open iTunes application window. If you need to move them between different computer user accounts, put them into /Users/Shared/.
    (74502)

  • Need to access a context_node in an another view of the same component

    Hi experts,
    I need to access a context_node which is not in my view but it exist in an another view of the same component.
    The component is ICCMP_BP_DETAIL.
    i need the context_node "CUSTOMER" from the view Bupadetail to view Bupacreate. so that i can make those context_node Attributes available in the configuration screen.
    regards,
    chella.

    Hi Chella,
    You can access the context node from other view using the custom controler or getting a context node from view that you are and use the method get_parent(to get predecessor objet) or get_related_entity(to get sucessor object).
    I think the second way is easier.
    Use transaction GENIL_MODEL_BROWSER and GENIL_BOL_BROWSER to know in wich object you are and where you have to go!
    Best regards,
    Caíque Escaler

  • UPDATING A TABLE WITH SAME INFO FROM ANOTHER TABLE ON THE SAME DB

    0down votefavorite
    I am trying to update a table with info from another table on the same db with same table name. I just want the info to be the same , no primary key or constraint involve just a straight replacement of records and I keep getting errors WITH THE TABLE not
    being recignize. below is my query:
    UPDATE
    VNDFIL
    SET EOBTYP
    =  VNDFIL.EOBTYP, 
    EDI_X12_835_VERSION =  VNDFIL.EDI_X12_835_VERSION
    FROM
    AGERECOVERY
    WHERE
    VNDFIL.EOBTYP
    = VNDFIL.EOBTYP
    AND
    VNDFIL
    .EDI_X12_835_VERSION
    = VNDFIL.EDI_X12_835_VERSION

    Hi rotary,
    If those two same named tables are in the same database then they have to be in different schemas. If you mean they are in the same server instance, then they may be in different databases, besides the "table not being recognized" error,
    anyway you should use the fully qualified table names, that is database.Schema.Table(If across instances, ServerName should be prefixed) to avoid the table unrecognized error.
    Using Identifiers As Object Names
    With the fully qualified names, your update statement can be like below.
    UPDATE
    db1.schema1.VNDFIL
    SET EOBTYP = srcTbl.EOBTYP, EDI_X12_835_VERSION = srcTbl.EDI_X12_835_VERSION
    FROM
    db1.schema2.VNDFIL srcTbl
    WHERE
    db1.schema1.VNDFIL.EOBTYP = srcTbl.VNDFIL.EOBTYP AND
    db1.schema1.VNDFIL.EDI_X12_835_VERSION = srcTbl.VNDFIL.EDI_X12_835_VERSION
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • I tried to download a movie on my iPod touch but due to limited space, it did not download.  Then, I checked my credit card online, and I found the money was already taken.  How will I get it to download on another device with the same account?

    I tried to download a movie on my iPod touch but due to limited space, it did not download.  Then, I checked my credit card online, and I found the money was already taken.  How will I get it to download on another device with the same account? Also, I was wondering why they took my money even when it did not finish downloading let alone get downloaded?

    Welcome to the Apple Community.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option from the Quick Links section in the top right corner of the iTunes homepage in your iTunes application on your computer.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option which is revealed in the iTunes app on your iOS device by tapping the more button at the bottom of the screen.

  • ADF table and ADF form on the same view object

    Hi,
    As per the ADF demos available on ADF site, I created a jsf page with 2 panels. One panel is an ADF table based on a view object. And the other panel is and ADF form based on the same view object. My requirement is that as I scroll through the records in the ADF table, the ADF Form should dynamically display the details of the record in the ADF table. My understanding is that this should be automatic. However, its not working as expected. What have I missed?

    Hi,
    Apply PPR for form that displays details.
    Like :
    <af:table id="t3">
    </af:table>
    <af:panelFormLayout id="pfl2" partialTriggers="t3">
    </af:panelFormLayout >

  • Radio group in classic report based on another column on the same row.

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Application Express 4.1.0.00.32
    How can I have a radio group column based on an LOV utilizing another column on the same row of the report?
    For example: what if I had a survey application and depending on the likert scale that was assigned to the question there would be different possible answer choices:
    Question 1 on row 1 of the report: The class instructor was friendly?
    Likert scale choice is Agreement.
    Choices on Radio Group: Strongly Agree, Agree, Undecided, Strongly Disagree
    Question 2 on row 2 of the report: The class offered good materials?
    Likert scale choice is Quality.
    Choices on Radio Group: Excellent, Below Average, Average, Above Average, Excellent
    The radio group can change per row depending on the Likert scale assigned to the question which is assigned to a different column on the row.
    Can LOV utilize the column? :
    SELECT scale_text
    FROM scale_choices
    WHERE scale_category_choice_id = 2 <<= this would be the Likert scale identifier
    ORDER
    BY display_order

    Here is the answer:
    APEX_ITEM.SELECT_LIST_FROM_QUERY(
    p_idx IN NUMBER,
    p_value IN VARCHAR2 DEFAULT NULL,
    p_query IN VARCHAR2,
    p_attributes IN VARCHAR2 DEFAULT NULL,
    p_show_null IN VARCHAR2 DEFAULT 'YES',
    p_null_value IN VARCHAR2 DEFAULT '%NULL%',
    p_null_text IN VARCHAR2 DEFAULT '%',
    p_item_id IN VARCHAR2 DEFAULT NULL,
    p_item_label IN VARCHAR2 DEFAULT NULL,
    p_show_extra IN VARCHAR2 DEFAULT 'YES')
    RETURN VARCHAR2;

Maybe you are looking for