A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: what is the code to play a music from library? AS2

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    14

    what is the code to play a music from library? AS2

    as above

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Right click the file in the library and choose linkage.
    Select "export for ActionScript".
    Insert an identifier, e.g.: my_sound.

    Attach the following code to the main timeline:
    PHP Code:
    var mySound:Sound = new Sound(this); // create a sound object
    mySound.attachSound("my_sound"); // associate the file in the library with it
    mySound.start(); // start playing 

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    10
    Two other good ones are:

    PHP Code:
    mySound.stop();  // stops the sound playing
    mySound.setVolume(100);  //sets the volume (0-100%) 
    -Chris

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