Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mySound.start

Status
Not open for further replies.

boatguy

Programmer
Oct 22, 2001
153
US
First let me prefice my questions with; I was asked by a friend to help (for free) create a music player for his sister's website and I agreed to help not having a clue what I was getting myself into. I have played with Flash one other time in my life and have no other training...what was I thinking! 15 hours into this and I am thinking I was off my rocker. My wife did all of the graphic work, but charged them. I wish I was as smart as her.

We have 10 songs that we want to play. So, I created 10 scenes and used the following code in each, changing the sound to the appropriate song:
Code:
mySound = new Sound();
 mySound.attachSound("Loves_Philosophy");

In the first scene I also added:
Code:
 mySound.start(0,1);

Everything is working, albiet I am sure it's the most inneficient way to so this as the swf is 9 megs and take 60 seconds to load via my cable connection. Dial up I am sure would never work.

Here are my questions in order of the level of frustration they are causing me:

1. I want to add mySound.start(0,1); to each scene so the song starts to play when the visitor goes to this scene. I tried putting it in every scene, but every song started to play when the movie loaded...that sounded bad ;-) How can I play the song only when the scene plays?

2. I have tried 15 diferent preload screens and can't get them to work. Basically I created a new screne and placed it at the top of the scene list. What happens is I get a blank sceen for a long time, then a flash of the preload screen and then the first music scene loads. One note, each scene only has one frame. Suggestions?
Here's the last preload script I used:
Code:
totalBytes = Math.round(getBytesTotal() / 1024);
loadedBytes = Math.round(getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
if (_root._framesloaded >= _root._totalframes)
{
	    gotoAndPlay("song1", "start");
}
3. I am sure there's a better way to do this. I tried loading the mp3 files dynamically by using the leadsound method, but could not get the songs to play. Should I be trying to get this method to work so that I don't have the mp3 files in the library and thus reducing file size?
I was using the following code for my attempt at dynamic loading:
Code:
myMusic = new Sound(lovesphilo);
myMusic.loadSound("loves_philosophy.mp3");
myMusic.start(0,1);

The url where the app is currently running is and the music player will load in the bottom right corner.

I know that's a lot to ask you folks to address and will appreciate any help you can provide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top