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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to play an mp3 via loadmovie? please help 1

Status
Not open for further replies.
Your file getalittle.swf, can't be found!
Have you uploaded it? Is it in another folder?

Regards,
new.gif
 
OK! Hear it this time! Must be quite large, and you don't have a preloader on it, so we might think nothing's happenin' while it's downloading in the user's cache!
You should add a preloader eventually! Especially for slow dial-up connections.

In your main movie, on that green arrow button (I imagine that's where you want to play this tune!) add the following script:
Code:
on(press){
loadMovieNum("[URL unfurl="true"]http://ewelch25.home.attbi.com/GetALittle.swf",[/URL] 1);
}

What this is doing, is loading your tune on level 1 of your main movie. If you're already loading a movie on that level, load it on a higher level.
But as I said, since you have no preloading message, it may take a while to hear something. It did take quite some time for me, and I'm on cable!

If this doesn't work, guess you'll have to send me your main movie .fla (or post a link to it, if you can upload it to your site), so we can have a look at it!

Regards,
And might I be blessed with your vote!
new.gif
 
Thanks a lot. That worked great. Now to figure out a pre-loader while my girlfriend is still sleeping
 
Also. yes it is a big mp3 in the getalittle.swf. One thing about the getalittle.swf is that it was not set on stream. It was set on start. I've read that setting it on stream is better because you dont have to wait for the entire download for it to play. The only thing is I cant figure out how to make the stream setting work. When I test it in the the fla with sync set to start, It plays fine, but with sync set to stream it dosnt play at all. :( What gives?. I suppose I could make a smaller mp3 and attempt my first pre-loader. Hrm, mabey reading up on some more flash is the answer :)
 
Several things to consider here.

When using an Mp3 as a streaming sound, the sound as to be recompressed, or it will not play. Now in this case, you may not like the quality of what you'll hear! To check it out, double-click the sound in the Library to open the Sound Properties. Set the Compression to MP3, uncheck the Convert Stereo to Mono box, set the Bit Rate to 160 kbps and the quality to best. Test the sound. Now what your hear is what you'll get at best. If you don't like it, you better forget using a streaming sound. If it's acceptable, then you'll have to make sure the sound movie holds as many frames as the sound lasts and set a soundbuftime. You shouldn't loop a streaming sound either!

If you decide to keep your sound as an event sound, and add a preloader, try the following:
Insert a new scene in your sound movie, name it preload, and in the Scene panel, drag it to be the first scene in the scene order. On the actions only layer insert 3 keyframes and add the following:

Frame 1:
if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
gotoAndPlay ("Scene 1", 1);
}

Frame 2:
if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
gotoAndPlay ("Scene 1", 1);
}
// Display dynamic text fields...
loadedBytes = _root.getBytesLoaded();
totalBytes = _root.getBytesTotal();
display= loadedBytes+" KB OF "+totalBytes+" KB LOADED!";

Frame 3:
gotoAndPlay (2);

Now on another layer, insert a keyframe on frame 2. Leave the first frame of that layer blank, and on the second frame, create a dynamic textfield with display as the variable set in the Variable box of the Text Options panel. Hopefully you'll have created this sound movie of the same size as your main movie, so position your textfield so that it appears somewhere above your cd (and button) in your main movie. If it's not of the same size, then you'll have to position it more accurately and/or scale it accordingly. Test your movie. The preloading display should appear!

Loosing my machine for a few hours, if not for a few days (upgrading), so might not be able to help you more than that for the moment.
Will be back to check in on you though, with my portable!

Regards,
new.gif
 
Wow thanks for the tips oldnewbie. You sure know how to help out a newnewbie! Im going to work on the preloader and check out the properties of the mp3. I'll let you know what I can manage.
 
Thanks oldnewbie that worked out great.
 
Ok!
You may want to check the following:

First, don't think you've followed my directions exactly, 'cause I can see a flash frame of the preloader on a second press (my second point) of your button. Make sure that first frame remains clear of any textfield and/or graphic... Only the actionscript code I posted above should be on that first frame.
My second point is precisely that if you want to avoid the track re-starting (on another press) while it's already playing, post your button's code, and I'll have you add a few lines that will take care of that!
new.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top