A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Problem With Understanding Player Script

  1. #1
    Rore
    Join Date
    Nov 2005
    Location
    Vermont
    Posts
    42

    Problem With Understanding Player Script

    How Would I write This script to only play the mp3 when the play button is pushed instead of when the page loads?


    my_sound = new Sound(this);
    my_sound.loadSound("http://www.townesquaremall.150m.com/music/FleetwoodMac/rumors/Fleetwood Mac - Go Your Own Way (3).mp3", true);

  2. #2
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    You can place it directly on a button:
    [actionscript]
    on(press)
    {
    my_sound = new Sound(this);
    my_sound.loadSound("http://www.townesquaremall.150m.com/music/FleetwoodMac/rumors/Fleetwood Mac - Go Your Own Way (3).mp3", true);
    }
    [/actionscript]

    Take a look here:
    http://www.kirupa.com/developer/actionscript/sound.htm

    3P

  3. #3
    Rore
    Join Date
    Nov 2005
    Location
    Vermont
    Posts
    42
    Thanks It Works Like A charm.

  4. #4
    Rore
    Join Date
    Nov 2005
    Location
    Vermont
    Posts
    42
    O.K. When adding this player to my site when the song is finnished I have to refresh the page in order to play another song is there a way to fix this? What am I doing wrong?
    The web site is at http://www.theofficialgamezone.com/music/index.html
    Just click on any album cover to check it out.

  5. #5
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    Hi maxisky, I could go into a long drawn out explanation but this topic has been covered so much on flashkit that it would be faster and easier to search the forums for your answer.

    It all comes down to the sound object.
    If you create a sound object outside the button, you can load sounds into that obect whenever you want. As it is you are trying to duplicate the object.

    3P

  6. #6
    Rore
    Join Date
    Nov 2005
    Location
    Vermont
    Posts
    42
    OK I Rewrote the program and it seems to be working the way I want it thanks for your help

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