dcsimg
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: I'm stucked... :D

  1. #1
    Member
    Join Date
    May 2008
    Posts
    46

    I'm stucked... :D

    i'm working at a game and i wanted to ask something....

    is there a way to se the volume of a sound BESIDE the " element ("sond").setVolume (value) "


    is there a way to stop ALL the sounds that are playing (with a script?)
    i have about 200 sounds and i'm just too lazy XD
    Don't blame me cuz' my English sucks ) i'm from romania XD

    www.xelubest.ro

  2. #2
    Member
    Join Date
    Nov 2007
    Location
    Brazil
    Posts
    47
    try stopAllSounds()
    work only when export
    []'s
    leocavalcante.com

  3. #3
    Member
    Join Date
    May 2008
    Posts
    46
    not working
    Don't blame me cuz' my English sucks ) i'm from romania XD

    www.xelubest.ro

  4. #4
    3DFA hobby scripter LewxX's Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    You can put all sounds in a array
    and stop them this way:

    for (a=0; a<200; a++){
    sound[a].stop();
    }
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  5. #5
    Member
    Join Date
    May 2008
    Posts
    46
    well it may sound funny... but i don't know how to make an array (i suck at scripting)

    anyway.. here are some news about the game


    Feautures:

    -11 looping negatives (freestyle mod)
    -9 differit beats (in timeline mod something like guitar hero, gotta catch the notes)
    - 18 beatbox sounds (on keyboard not button for mouse)
    -ambiental sounds
    - verry friendly design , you can hide \ un-hine anything pannel you want
    -funny animations that keep everything active


    and a print screen

    Don't blame me cuz' my English sucks ) i'm from romania XD

    www.xelubest.ro

  6. #6
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    As someone else suggested, it's probably quickest to learn how to do an Array

    In a nutshell, an array means that instead of having:

    YourSound1 = ...
    YourSound2 = ...
    YourSound3 = ...

    You just use:

    YourSound = new Array (3)
    YourSound[1] = ...
    YourSound[2] = ...
    YourSound[3] = ...

    And then instead of referencing these variables with the exact name Sound1, Sound2, Sound3, etc, you can use:

    for (a=0 ; a< YourSound.length() ; a++)
    {
    YourSound[a].stop()
    }

    Dead easy really. I was scared of arrays for years before I realised how simple and useful they are

    Hope this helps, and looking forward to seeing the finished result. Looks interesting

    Morgan.
    Last edited by ForumNewbie; 06-07-2008 at 09:48 AM.
    Please note that my domain has changed to http://www.morganmultinational.com

  7. #7
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    looks like a pretty cool game xelubest

  8. #8
    Member
    Join Date
    May 2008
    Posts
    46
    thanks ^.^

    it's almost 70% done now...

    now i need a script so i can make an "slideshow" (object) .. shake

    something to change the X Y position randomly by 2-3 pixels

    looping

    can somebody help me?
    Don't blame me cuz' my English sucks ) i'm from romania XD

    www.xelubest.ro

  9. #9
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126

    Post How to do the shaking script

    You want to change the X, Y positions of an image to simulate a shake (during sound play???)

    to simulate a shake, you would put in the on every frame script...

    element ("cloudy blue sky").x = (root.width/2)+random(4);
    element ("cloudy blue sky").y = (root.height/2)+random(4);


    now, when you do this, make sure that your image is around 10 pixels wider, and 10 pixels taller than your movie.

    if you want simulate this only during the playing of a sound put...

    if (element ("your_sound").position != 0){
    element ("cloudy blue sky").x = (root.width/2)+random(4);
    element ("cloudy blue sky").y = (root.height/2)+random(4);
    }


    now, since you have so many sounds, you should probably have them in an array... so try this

    for (var a=0; a<sound_array.length; a++){
    if (sound_array[a].position != 0){
    element ("cloudy blue sky").x = (root.width/2)+random(4);
    element ("cloudy blue sky").y = (root.height/2)+random(4);
    }
    }


    hope this helps...

    Zoranan
    Last edited by Zoranan; 06-09-2008 at 04:37 PM.

  10. #10
    Member
    Join Date
    May 2008
    Posts
    46
    works 8->

    well thanks for the "on sound" an array thing but my sistem is simple...

    ia have a slideshow with the slides... NONE (empty) , A (.png pic) , B , C ... so on

    when you press a key.. the slides change.. and when you release.. it goes back to NONE

    thanks again
    Don't blame me cuz' my English sucks ) i'm from romania XD

    www.xelubest.ro

  11. #11
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126

    oops, didn't attach the file

    hey, I forgot to attach the file, but I thought of something else to.

    If your game has volume control, maybe the image should shake more violently with loader volume!

    if you want to do that, try this

    for (var a=0; a<sound_array.length; a++){
    if (sound_array[a].position != 0){
    element ("cloudy blue sky").x = (root.width/2)+random(sound_array[a].getVolume()/10);
    element ("cloudy blue sky").y = (root.height/2)+random(sound_array[a].getVolume()/10);
    }
    }


    just remember, that the more violent the shake is, the bigger the image has to be (bigger than the root) Also, make sure that the position of the center of your image is... well... centered. not set to 0,0

    Zoranan
    Attached Files Attached Files

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