dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: sound and movieclip

Hybrid View

  1. #1
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Hi,

    I have a movieclip, which will play when I push a button. I want to simultanously play a sound. I cannot put the sound into the movieclip, because I want to play different sounds. So I have to use AS. It is only a short period of 2 seconds or so. What code I have to use?

    Thanks in advance.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I made a separate mc for the sound, where the sound starts in frame 2("start") and is initiated by
    _root.sound_1.gotoAndPlay("start");

    but doesn't work.

  3. #3
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Why not use a sound object and attachSound to it?.. then you can control whatever sound you want.

    Code:
    //create a clip to attach a sound to
    _root.createEmptyMovieClip("player",depthCount++);
    //create a sound Object that targets the newly made clip
    someSound=new Sound (player);
    //attach a sound from the library, linkage name of "tune"
    someSound.attachSound("tune");
    //start playing that tune
    someSound.start();

    Not sure why your mc isn't working.. everything named properly? How many frames does the sound clip have in it? Enough for the whole sound? (I guess important if set to streaming.)


    Good Luck!

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Hi Antibody,

    thanks for your answer. I will try your solution also once, because I tried attachSound first but using an existing mc and not using createMC.

    Actually later my MC worked. I had just forgotten to put it on the stage and to give it a name.

    ________
    As you get older....

  5. #5
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    I had just forgotten to put it on the stage and to give it a name.
    um woopsie.. that usually helps out a lot. ;p

    You don't have to do the createEmptyMovieClip. You could attach the sound to the movieclip that you were wanting to control in the first place. Then through code you just attach different sounds as appropriate.

    In any event I am glad to hear that you got things sorted.


  6. #6
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I tried that in the past w/o success. I will try it tonight and let you know if I have difficulties.

    Thanks again for your help


    ___________
    And on the first day God created Flash....

  7. #7
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Please do..


    Hey man, no worries, you're welcome.

    If you'd like, when I get home tonight I can make you an example/tutorial .fla of this idea.

    l8r

  8. #8
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    That would be great! Many thanks

    Tonight I will also have finished one important part of my presentation. I don't know if you know anything about microarrays. But a company attending a bioinformatics group wanted to show microarrays (also called genechips) and when you press on one of those many spots the identity of the gene pops up with a link to the site, the expression level of the protein is shown as a sound wave and you have sound. They are crazy but they think this will be useful to show to investors.

    By the way have you ever found out something from Martin Hairer regarding the sound info?

    Sorry for bombarding you with all those questions.

    __________
    And on his second day God created Adam using the Flash pen tool...

  9. #9
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Oh shoot, yeah Martin did respond. I should have posted but the info he gave me was :\ so I didn't bother. Basically he said that his software outputs to a text file but that "his software couldn't be used as some sort of server to analyze streaming data if that's what you are after". Nope, I just wanted to know if it generated a textfile hehe.

    Well I did try out his software (which is real nice btw and probably very useful for people who um "know" sound, which ain't me) and I did output a textfile but I'm not exactly sure how to use what I saw in that textfile for anything that we were talking about. I did find out about a plugin or somesuch for Director which does pretty much what we want, only it is in Director. Can't think of the plug-ins' name off the top of my head so I'll let ya know later.


    Anyway, I'll make that demo. What I propose to do is to make a movieClip with an animation, make duplicates of that clip and then attach various sounds to them via the attachSound method. For clarification, all your "spots" are the same animation? and you want each one to have a sound, am I at least on the same page with ya?

    Talk to you soon,


  10. #10
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    All spots are covered by buttons with the same function but a different id from an xml file (1,2,3 etc.) I have one mc which looks like some kind of sound wave but I made instances with different colors and sizes according to the level of expression. So I want to attach different sounds as well. Once it is working I will upload and show you. You can also have a copy of the files, since this kind of thing is useful for many different purposes and the code is not very difficult.
    The sound program is really neat. You can do many different effects with the new plugins he added and inexpensive.

    ______
    And on the third day God uploaded a bitmap of the paradice and put Adam into it....

  11. #11
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Yo cancerinform-

    Here is a zip with a .fla in it for you.

    forCIF.ZIP

    Basically what I did was make a movieClip called 'masterspot' with linkage name "spot"

    'masterspot' contains a bg, a button and some code for the button

    There are 2 functions on the _root. Basically, one makes a grid of 'spots' by attaching instances of 'masterspot' to the _root. As each spot gets attached, a variable which holds the name of a sound that that spot should play is also generated. The button, when released, then calls the other function on the _root which 1)makes a sound Object using the clip that called it 2)attaches the appropriate sound and then 3) plays that sound.

    I commented the code so as to hopefully make it understandable. It isn't rocket science, so it should be easy enough to figure out.

    Let me know what ya think.

    Bye for now,


  12. #12
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Hi Antibody,

    that little fla is awsome, thanks a lot!!!

    At the moment I will stay with my present version for the presentation because for showing the idea it is sufficient, but I will try to incorporate your version into my file, which will require some work. Actually you may have solved another problem as well. I have many buttons. If I put over 50 button instances on the stage I noticed the AS bar identifying the object starts flickering and it takes a long time until the AS appears in the window. So your version of creating buttons and adding one function (I need to add one parameter to this function, 1,2,3 etc) would solve this problem and allow me to put as many buttons I need.
    Yesterday I was tired and did not work on my file. I will, however, post my present version here for you to download.

    Talk to you soon.

  13. #13
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Hi Antibody,

    here are the files
    http://www.stormpages.com/cancerinfo...ase/array.html
    Tell me what you think. It's nothing spectacular but to use this for that particular purpose is new.

  14. #14
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Hi cancerinform,

    The download link isn't working bro.

    Looking forward to seeing it.

    peace

  15. #15
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Hey
    Sorry for that. File is pretty big and was not uploaded. I split into two and loaded to this location
    http://can_info_guide.tripod.com/flash/array.html
    By the way here is a pic of a genechip from Stanford Univ. This looks like it could be an interesting flash project. My thing is a small genechip but principally the same. And only the top 1.5 rows have buttons. For demonstration enough.
    http://genome-www.stanford.edu/breas.../explore.shtml

    Have a nice holiday.

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