A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 36 of 36

Thread: [RESOLVED] No sound in Flash CS6

  1. #21
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Heheheh i have a lot of mp3's in my game and none of them work. I tried using Windows Demo Mp3's (Sleep Away.mp3) no results. I proceed to system restore my pc. -_____- thanks for all the help, i thought it was something about the flash cs6 program, because i recently installed it. Thanks for all the help man!

  2. #22
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    FINALLY! The System Restore did the job.

    Now i can start the sounds with attachSound and loadSound. Now i need help with the loadSound. If if load the sound snd.loadSound("mySound.mp3", false); and then try to start it automatically with mySound.start(); , nothing happen. But if a create a button and put onPress { mySound.start(); } it plays it!!!!!

  3. #23
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    That's weird. I achieved doing this
    Actionscript Code:
    mysnd=new  Sound();
    mysnd.loadSound("newlevel.mp3", false);

    mysnd.onLoad=function (){
        this.start();
    }

  4. #24
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Few days ago, i could do the same with just

    Actionscript Code:
    mysnd=new  Sound();
    mysnd.loadSound("newlevel.mp3", false);


        mysnd.start();

  5. #25
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Now is another issue LOL. I imported all the sounds into the library, gave an identifier name and calling them with attachMovie("identifiername");

    BUT GUESS WHAT!!?!? NO SOUND!!!!!!
    *Relax angel, relax, don't cry*

    Omg...i think my Game's .fla got corrupted :'(

  6. #26
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I surrender. I give up. I'm going to sleep. Maybe in my dreams i come up with the solution.
    Sounds can be played/previewed on the library... but not attachSound("mysound");, nor loadSound("mysound.mp3", true); can start it, not in my game, not in a new totally empty .fla document. Not sound at all.

  7. #27
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    It's my computer. I did the system restore, and the problem persists. New .fla document,
    Actionscript Code:
    piano.attachSound ("piano");

    piano = new Sound();
     piano.start();

    import sound> piano.wav > identifier name "piano"

    NO SOUND.

    I then did the same proccedure in my Windows XP, in Flash CS5 PORTABLE, and yes, there is SOUND.
    And last, I test the same Flash CS5 PORTABLE in my windows 7, and NO SOUND.

    The system restore didn't work at all. So i think i have now to FORMAT my windows 7...

  8. #28
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Going to install the flash player 11.3 to check if it's that...if not, i'll try a Repair Windows. If not, bye bye windows, format C:/

    -____-

  9. #29
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Installing Windows 8 Consumer...heh

  10. #30
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Well...reinstalled windows 7, and the sound is working again, at least in a new .fla document. My game .fla sounds still don't work. This is all my code in the frame when is suppose to load the sounds, and start the background music instances name music

    actionscript Code:
    stop();

    //Variables
     nuevoBTN.btnTEXT="nuevo"  
      loadBTN.btnTEXT="continuar"
    clearCache.btnTEXT="borrar cache"

    var canLoad:Boolean;

    var saveState:SharedObject = SharedObject.getLocal("cookie");

    total_lvls = 8;

    var globalVolume:Sound = new Sound()


    //Functions
       
    //Load saved level
    function loadlvl(){
        trace("loading lvl");
        for(i=1;i<total_lvls+1;i++){
            if(saveState.data.rooms == i  ){
               
                gotoAndStop("lvl"+i);
            }
        }
    };



        function lvlsound(){
    trace("This is happening");
    newlevel.stop();
        newlevel.start(0,1);


    };

    //Restart level button
        function restart(){
    reiniciarBTN.onPress=function(){
            reiniciar=true;
        stopAllSounds();
    gotoAndStop(2);
    }
        };

    if(reiniciar==true){
            music.stop();
    loadlvl();
    };


           



    // declare sounds first, so that you may change its volume depending on the saved value

    music.attachSound ("music");
    music2.attachSound ("music2");
    newlevel.attachSound ("newlevel");
    music3.attachSound ("music3");
    window.attachSound("ventana");
    elisa.attachSound("elisa");
    success.attachSound("success");
    trashing.attachSound("trashing");
    failed.attachSound("failed");
    broken.attachSound("broken");
    broken2.attachSound("broken2");


    music = new Sound();
    music2 = new Sound();
    music3 = new Sound();
    newlevel=new Sound();
    window=new Sound();
    elisa =new Sound();
    success=new Sound();
    trashing=new Sound();
    failed = new Sound
    broken=new Sound();
    broken2=new Sound();
    ventana2=new Sound();


       
    //Music

    music.start();
    // check if saved value is declared/created
    if(saveState.data.pressedMut != undefined){
        // if yes, then set pressed's value as the saved value
        pressedMut = saveState.data.pressedMut;
        // execute this function, to execute the same set of code
        // by simply calling that function, saves a lot of time and is easy to edit
        checkMute();
    }
    else {
        // if not, then set default value as FALSE
        pressedMut = false;
        checkMute();
    };

    btn.onPress = function(){
        // this changes pressed's value to the opposite, if it's TRUE,
        // then it will turn to FALSE, and vice versa
        pressedMut = !pressedMut;
         saveState.data.pressedMut = pressedMut;
        checkMute();
        saveState.flush();
    };

    // the actual function
    function checkMute(){
        // check if pressed's value is TRUE
        if(pressedMut == true){
            // if it is, mute sound
            btn.gotoAndStop(2);
           
          globalVolume.setVolume(0);

        }
        else {
            // otherwise, unmute sound
            btn.gotoAndStop(1);
              globalVolume.setVolume(100);
           
        }
           
         
    };

    music.onSoundComplete=function(){
        music2.start();
    };

    music2.onSoundComplete=function(){
        music.start();
    };


       

    //Buttons


    //New game button

    nuevoBTN.onPress=function(){

    this.gotoAndStop(3);
       
    }
    nuevoBTN.onRelease=nuevoBTN.onReleaseOutside=function(){

    this.gotoAndStop(2);

    music.stop();
        music2.stop();
        gotoAndStop("lvl1");

    reiniciar=false;
    }
           
    if(saveState.data.rooms!=undefined){
        loadBTN._alpha=100;
        canLoad=true;
    }
    else {
        loadBTN._alpha=30;
        canLoad=false;
    };


        nuevoBTN.onRollOver=function(){

        this.gotoAndStop(2);
        }
        nuevoBTN.onRollOut=function(){

        this.gotoAndStop(1);
        }


    //Load button

        loadBTN.onPress=function(){


    if(canLoad==true){
    this.gotoAndStop(3);
    }

       
    };

    loadBTN.onEnterFrame=function(){
    loadBTN.onRelease=loadBTN.onReleaseOutside=function(){
        if(canLoad==true){
    music.stop();
    music2.stop();
       
        loadlvl();
       
       
        this.gotoAndStop(2);
        }
       
       

        }
        loadBTN.onRollOver=function(){
       
        this.gotoAndStop(2);
        }
        loadBTN.onRollOut=function(){

        this.gotoAndStop(1);
        }


       
    };

    //Clear cache button

    clearCache.onPress=function(){



    this.gotoAndStop(3);
       
    };
    clearCache.onRelease=clearCache.onReleaseOutside=function(){
       
        saveState.clear();

        canLoad=false;
       
        loadBTN._alpha=30;
    this.gotoAndStop(2);

    gotoAndStop(2);



    };

    clearCache.onRollOver=function(){
       
        this.gotoAndPlay(2);
        }
        clearCache.onRollOut=function(){

        this.gotoAndStop(1);
        };

    I have read that code, once and once again, like 8 times, and i don't find anything wrong. My games sounds are imported into the library with their corresponding identifier. Checked that too. My games sound and script was working , until a few days ago, when I did a system restore to an earlier time due to a Corrupted Messenger Plugin (lol) and then they stopped working. The adobe cs6 was installed long time before the restoration point i choosed to restore windows, so i dont think it has something to do with. If i import the same sounds into a blank .fla document's library, and copy the same attach sound scripts, THEY WORK!!!!! So is something in my game's .fla. I checked everythin, the config is Flash Player 11.2, Actionscript2, export hidden layers unchecked (the layer where is the code is not hidden, just in case) I checked the sounds properties in the library panel, mp3 compression, export for actionscripting, export in first frame, everything's fine.

    About everything else, the game script is working, buttons working, saving data to the shared object, levels, drags & drops, restart button, everything's fine, except the sounds. I hope someone help me because i'm tired of this, i could not keep developing the next levels because of this, it's fustrating not to hear a sound when you preview your flash game.

  11. #31
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Your code gives no errors here, but the sound does not work.

    However the sound does work if you swap this code around.

    Actionscript Code:
    music.attachSound("music");
    music2.attachSound("music2");
    newlevel.attachSound("newlevel");
    music3.attachSound("music3");
    window.attachSound("ventana");
    elisa.attachSound("elisa");
    success.attachSound("success");
    trashing.attachSound("trashing");
    failed.attachSound("failed");
    broken.attachSound("broken");
    broken2.attachSound("broken2");


    music = new Sound();
    music2 = new Sound();
    music3 = new Sound();
    newlevel = new Sound();
    window = new Sound();
    elisa = new Sound();
    success = new Sound();
    trashing = new Sound();
    failed = new Sound();
    broken = new Sound();
    broken2 = new Sound();
    ventana2 = new Sound();

    put the new sound codes above the attachSound codes

    my hobby

  12. #32
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Thanks. Your web site is great i like it

  13. #33
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Wow...wow...wow. I quiting actionscript...I GIVE UP!!! Wow seriously? Fruitbeard thanks, that did the job!!!!!! O M G!!!!

    I thought it doesn't matter where you put the code it would read it...but not...
    the new Sound(); MUST BE OVER AND TOGETHERwith the attachSound();
    I find this issue so stupid and embarrasing? I wanna cry! I stink in actionscript lol

    THANK YOU VERY MUCH, MADE MY DAY!

  14. #34
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Hi,

    seems like you've been having a very harsh time, angelhdz, hope it's working now

    And yes, the order does count in actionscript, because attachSound() is a function of Sound class, and you can't use it if you have not made an instance of that class, e.g.: mySound = new Sound(), then you can use mySound to access the functions of Sound class, like attachSound(), loadSound(), etc.
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  15. #35
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Thanks Nig, i'm a starter as you've seen. The only thing i learned on university was make a figure stick "dance" o.O and a car follow a path. Everyday, literally, a wake up to learn more and more.

  16. #36
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Oh, so you've finished school, lol :P

    Yup, experience comes with practice, and I've heard from a lot of people that IT teachers don't educate the students correctly, they're just lazy and make them do simple stuff or something :P
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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