;

PDA

Click to See Complete Forum and Search --> : Embedding sound files


indogo
12-07-2005, 06:22 PM
Hi

I'm using

ding = new Sound();
ding.loadSound("ding.mp3");
......
_root.ding.start();

to play a sound using action script.

The problem is I can't workout how to have the sound file embedded in the movie as is the case when using the add sound wizards for button actions.
At the moment the mp3 is in the same folder but separate on the server which works but seems a bit clumsy.

I have looked around but not found any info on this but could be missing the obvious here :rolleyes:

regards

mike

vanbao
12-08-2005, 09:12 PM
Is there a way to reference a sound file outside of the flash file. A friend of mine explained to me that this is a way to keep the flash file small and minimize the loading time. He said that if I embed the sound file in the flash file, that will make the flash file 3-4 times larger and thus taking longer to load.

blanius
12-08-2005, 10:06 PM
is there a way to reference a sound file outside of the flash file.
That's exactly what he's doing in the code above. and your friend is right. That's why I don't understand why indogo wants to embed it.

At the moment the mp3 is in the same folder but separate on the server which works but seems a bit clumsy.

actually rather than clumsy it's the preffered way to go.

Bob Hartzell
12-09-2005, 08:19 AM
To embed, use the link button in the action script editor to assign a link name to the sound and use the link name in attachSound.

indogo
12-09-2005, 02:23 PM
Ok thanks bob.........there's always an answer....just have to ask the right question....cheers..

Blanius the sound files are both 2k and the flash is 25k so the extra overhead is minimal and i have an obsession with tidiness which the clinic is helping me with.

Thanks for the feedback all

regards

mike

indogo
12-11-2005, 05:44 PM
So simple when yer know how..

Worked a treat......I have a learning curve resembling the Alps

many thanks

mike

indogo
12-11-2005, 05:46 PM
For thread completeness the second line becomes

ding.attachSound("linkname");

dniezby
12-13-2005, 02:12 PM
Is this the same code I'd use to stream music for an entire movie?

Maybe I should be creating an on/off music button?

indogo
12-13-2005, 05:59 PM
mySound = new Sound();
mySound.loadSound("samples/butterflies40.mp3", true);
mySound.start();

is what you would need to stream music..........'true' to stream 'false' to load the whole file before playing.With suitable comprssion music can be played continuously on dial up.
The link can be absolute or relative.
if you wish to sync the movie with the sound then the technique is more involved.there is a thread on here to do with lipsyncing and probably others as the movie will play at a different speed on different machines but the music will normally play at its normal speed.
It can be used in a button using on(release){'the above'}
and stopped using stopSound..
Hope this helps

mike

dniezby
12-13-2005, 06:16 PM
Thanks. I'll give this a go and let you know if I succeeded.

dniezby
12-13-2005, 06:55 PM
Ok, here is what I did.

I made a small file and put a button in it.
Then I put this in the button.

on(release){
mySound = new Sound();
mySound.loadSound("come.mp3", true);
mySound.start();
}


But nothing happens. Any thoughts?

tmoore935
12-13-2005, 08:28 PM
Ok, here is what I did.

I made a small file and put a button in it.
Then I put this in the button.

on(release){
mySound = new Sound();
mySound.loadSound("come.mp3", true);
mySound.start();
}


But nothing happens. Any thoughts?
Your code works for me. The export setting should be at least flash 6. I made a shape, made it into a button, added your code into the actionScript and it played.

dniezby
12-14-2005, 12:25 AM
I had to close KM and reopen the file for it to work....strange.
Anyway it works now but how do I get it to keep playing throughout the movie?

tmoore935
12-14-2005, 12:31 AM
what is it doing? I should play to the end of the song. I forgot to tell you about closing the file and reopening it.

dniezby
12-14-2005, 01:16 AM
What is it with you? Do you have some type of powers? Everytime I say something doesn't work after I've followed your steps, then go back to try again it suddenly works.

Maybe you can tell me what's wrong with my car? LOL.

Well, everything seems to be working now...(Knock on wood)

tmoore935
12-14-2005, 12:50 PM
What is it with you? Do you have some type of powers? Everytime I say something doesn't work after I've followed your steps, then go back to try again it suddenly works.

Maybe you can tell me what's wrong with my car? LOL.

Well, everything seems to be working now...(Knock on wood)

I have played around a lot with the mp3 a lot, while spending little time learning useful stuff like php. I also practice :p witchcraft.

indogo
12-14-2005, 04:35 PM
Yep flash 6 is a must.

Is the swf file and the mp3 file in the same directory?
Also if you embed the file into a webpage the address will be relative to the webpage and not where the swf comes from.

I just lay my hands on things to get them to work but only for others.never works for myself..

Do you have a stopSound somewhere in the movie as otherwise the sound should play to the end.
Have fun

mike

dniezby
12-14-2005, 07:59 PM
Yeah, everything is working now.

What I finally did was put this in the first frame.

// Load and play music at start
mySound = new Sound();
mySound.loadSound("come.mp3", true);
mySound.start();
btn_soundon._visible = true;


And this in the sound button action:

//Turn sound off, show sound on button
on(release){
btn_sound_off._visible = true;
btn_sound_on._visible = false;
mySound.stop();
}


This action went into the button action that turns the sound back on.

// Turn sound on, show sound off button.
on(release) {
btn_sound_off._visible = false;
btn_sound_on.visible = true;
mySound.start();
}

indogo
12-22-2005, 10:18 AM
To streamline the code if the off button is laid over the top of the on button then only the off button needs to be toggled visible/invisible if you see what I mean.

A question........if for a server that does not allow mp3 I embedded the sound file into a flash movie which is then loaded by the main/control movie what would be the best way to still stream the sound......by setting streaming in the sound flash movie or can the flash be streamed by the main movie ?.if again you see what I mean

regards and merry christmas

mike

tmoore935
12-22-2005, 05:22 PM
To streamline the code if the off button is laid over the top of the on button then only the off button needs to be toggled visible/invisible if you see what I mean.

A question........if for a server that does not allow mp3 I embedded the sound file into a flash movie which is then loaded by the main/control movie what would be the best way to still stream the sound......by setting streaming in the sound flash movie or can the flash be streamed by the main movie ?.if again you see what I mean

regards and merry christmas

mike

If I understand what your saying, The server that you use does not allow mp3's to be uploaded. If you embed the mp3 by not clicking the stream checkbox, then the server only sees a swf. Using stream is something that you can try and see if it works. Anytime you stream a mp3, it is loaded seperatly from the swf. If you embed the mp3, then you upload only the swf because the mp3 is inside of the swf. If the mp3 files are mega size then stream, If the are say 20kb, I say embed. This is only my opinion here.

gusmus
12-22-2005, 05:30 PM
If the mp3 files are mega size then stream, If the are say 20kb, I say embed. This is only my opinion here.

And rightly so Tim. A nice tidy site that takes ten minutes to open or an untidy one that opens instantly. Mind you, there are very few hosting sites that refuse mp3 these days, especially if you prove copywrite or permission of usage.

tmoore935
12-22-2005, 07:11 PM
I don't know exactly what is wanted but he could always use the flv technique
http://www.diversioncentral.com/flv/flvmp3b.html

indogo
12-22-2005, 09:58 PM
Well its for our original music so copyright is no problem...just we need to move sites soon and quite a lot say no mp3's (and zips etc....think they want to avoid remote linking)plus I need php/sql and freehosting just to be awkward with minimal ads so finding that combination is a bit trickier.Perhaps if I ask nicely.......
Looking at koolmoves the stream option does as you say and is basically doing the same as the action script I posted earlier so no gain there.And load movie looks like it loads the whole movie and then plays so no go.....we have fast opening pages with reasonable quality music playing plus realish time music samples which works well even on dial up
I'll have a look at the flv technique as you suggest.
I could host the mp3's on a separate site which allow it but that really is getting messy.

Thanks for the info..I just wondered if there was a way I had missed.......

merry christmas

mike

Chris_Seahorn
12-22-2005, 10:35 PM
Maybe another way to not have an mp3 sitting on the server if they are disallowed...

http://www.swift-tools.net/index.html?mp3

There are also others that convert.

dniezby
12-23-2005, 01:01 PM
Well its for our original music so copyright is no problem...just we need to move sites soon and quite a lot say no mp3's (and zips etc....think they want to avoid remote linking)plus I need php/sql and freehosting just to be awkward with minimal ads so finding that combination is a bit trickier.Perhaps if I ask nicely.......
First, if you want to run a site like that, you need to forget about free webhosting. Hosting services are pretty cheap so if you're running a site for any other reason then simply having one, get a hosting company. I've been with the same company since 98 and I'd highly recommend them. http://www.sitelutions.com I also would recommend www.ipowerweb.com

That will solve all of your file problems.

indogo
12-23-2005, 02:06 PM
Well I'd love to forget about freehosting but I have to remember I have no credit card and not likely too in the forseeable future.......so resourcefulness is the other option

Chris that solution looks good. The flv route.........well it looks very inticing for future video ideas. I can see a new year learning curve approaching.

Regards to all for joining the 'lets make this thread a long one campaign' ,your help is appreciated,
mike

tmoore935
12-23-2005, 02:33 PM
Chris that solution looks good. The flv route.........well it looks very inticing for future video ideas. I can see a new year learning curve approaching.

Using swift-tools will put the mp3 inside of the swf still, so it is no different than letting koolmoves doing it. (Mabye chris has something up his shirt sleave). The graphic equalizer does work with koolmoves as I have used it. You could try changing the mp3 extension to mpx as this method works with koolmoves also.

gusmus
12-23-2005, 05:04 PM
I think the "flv" would be the way to go. As far as I know, nobody is refusing FLV files on their servers. Just convert your mp3 to flv (flash video,,but with no video,,soundtrack only,, and call it up in the same way as an mp3 to your swf presentation.

Chris_Seahorn
12-23-2005, 06:20 PM
(Mabye chris has something up his shirt sleave).

No such luck. I think you're way of embedding is probobly the best since his host disallows mp3 uploads. My reply was only a second possible solution if it has to be a sound file pulled in externally....at least that way he could curcumvent the mp3 ban by uploading swf conversions or like Gusmus says by pulling them in as FLV.

gusmus
12-23-2005, 06:27 PM
Actually you hit it on the head Chris. Make an empty swf with the mp3 embedded and simply call that.. no conversions, no nothing. Dead simple as well. May be a pain to strean though. I have a program somewhere that will record flv sountrack only. I'll search for it and post later.

Try this http://www.rivavx.de/ it's a30 day trial but it works ok.

Chris_Seahorn
12-23-2005, 06:32 PM
Been so long since I used a production host I was surprised to hear some are disallowing these. Is this common now? Or just with the lowball freebie hosts?

gusmus
12-23-2005, 06:42 PM
I have a standing contract with my host to cover me for mp3 usage as a business but with a standard public account they are starting to block even midi files... it's all the crap falling from the anti piracy industry and it's affecting everyone. I'm on the point of dumping the hosting contract and just using my own servers but I have a big wifi net set up here and I'm a bit worried about saturation. Could always go bankrupt and hire another T1 I suppose.

Chris_Seahorn
12-23-2005, 07:14 PM
I like your FLV solution just because Tim already has the controller setup and as Koolmoves to boot. Even if you chose swf you would have the extra coding of manipulating it and I think in that context his FLV controller is far superior. Coupled with that link Gusmus posted for Riva...it's a no cost end run around their host bans.

MoonRise
12-23-2005, 07:18 PM
If I'm not mistaken, it is the "Anti-Piracy" movement that is driving this. The Recording Industry has been suing the Hosts since they could not legally go after the end users or "force" the Host to tell them who was "pirating" :yarr: . The recording Industry then turned and said that it was the Hosting Sites that were "encouraging" copy right enfringment and there you have it. Keep legitamate small enders from creating! Enough of the soap box. Sorry. :)

indogo
12-23-2005, 07:23 PM
Ok I'm overwhelmed.cheers guys......if this was a poll I'd say flv wins......I'm curious about the mpx idea....so simple it might just work....
Well I'll have to go and do some site stuff so I'll post on anything I find out when I do.
I was surprised at the mp3 thing at first, and the other thing is very few offer mail functions due to spamming abuse which makes hosting a forum etc a bit tricky.Even sql abuses......

ok
nearly merry christmas all

mike

indogo
12-23-2005, 07:34 PM
We make and sell/promote our cd's ourselves..you can understand why......perhaps if they dropped the price a bit for something that newspapers here give for free then the pirates would have less of an impact......Yes we are definately going off topic so I will stop there......

cheers again

mike

gusmus
12-23-2005, 07:35 PM
Indogo. If you really want to get around your hosting company (assuming that they are php and mysql enabled) you my be worth trying "PHP-Nuke". If you load it into your hosting package then it basically works like a server within a server, if you get my meaning. Your host will pick up on your management and public access files but won't have access to the content. It's a bit of work to set up but it is an option worth considering.

tmoore935
12-23-2005, 07:40 PM
.....I'm curious about the mpx idea....so simple it might just work....
Well I'll have to go and do some site stuff so I'll post on anything I find out when I do.
mike

try the mpx and make sure you change both the koolmoves actions and rename the mp3 file to 1.mpx....I don't see how to use the koolmoves "start sound to get a mpx". Only wav and mp3. So try:

Sound = new Sound();
Sound.LoadSound("1.mpx", true);
Sound.start();

Also if you can sneak an mpx to your free server with ftp, then it should work. I have many mp3 player (except xml) so I can send an example if you want or you may want to do it yourself. And if you can educate yourself to effectively use the free websites, when it comes time to rent a server with your own domain, it will be a breeze with a lot of new benifits and unlimited options.

Chris_Seahorn
12-23-2005, 07:44 PM
First, let me apologize for wrongs of the past. Gusmus...I'm sorry for the things I've said in the past and hope you see this post as what it is. Docree was treated no better by me as well. I was wrong and hope you guys rate me on future posts and not past ones.

I think your idea is great. I think another portal...any other...would be a better choice. A ton of hosting companies have a global ban against PHP-Nuke servers because of all the sql injections. My UpstateTemplates.com was halted after serving 1.5 years with it due to my server (Hostnuke if you can believe it) instituting that policy as well. I had no legal recourse. It's why I began serving my own site so it could never happen to me again.

Opensourcecms.com has tons of free portals that would do exactly what Gusmus suggests Indogo and ALL of them are a breeze to setup.

Merry Christmas!

gusmus
12-23-2005, 07:53 PM
Gusmus...I'm sorry for the things I've said in the past and hope you see this post as what it is.
Don't sweat over it Chris, I'm sorry for the stupidity on my part as well. I'm a hot headed idiot when get aroused (must be that Scottish / Italian blood lol).
Best we try to work together and help, not hinder each other or other users (especially new ones), they are the important ones. Have a happy foodfest, Santa is getting impatient for a reindeer steak.

Chris_Seahorn
12-23-2005, 07:56 PM
That means a lot to me Gusmus. Merry Christmas to you and yours and to all Koolmoves users.

Sorry for jacking the thread Indogo. I owe you one.

gusmus
12-23-2005, 08:27 PM
Indogo. The simple solution is to get hold of a good old workhorse computer,, something like a P111 or a Celeron 1000 or 1300 mhz (they can be loaded up better than P4 or Amd without overheating). Load it with 1 giga of ram and a 40 giga hd and stick it on to your dsl connection using apache 2 as a server (Fedora Linux latest build is better than XP and has Apache as standard). you can serve whatever file you want and it's still be free. The computer will be virtually free, Apache, PHP, Mysql and sygate firewall are all free, all you have to shell out is a few bucks on some ram and a net switch or router/modem so it can run the server when everything else is switched off. You can use your own domain with e-mail by using "dyndns.org"

gusmus
12-24-2005, 01:44 AM
Chris.. one little huge thing you mentioned regarding past and present posts. A lot of people would love you to replace your scripting posts that you removed (with explanations for the short of brain,,, like me) I know **** about scripting apart from the basics but I think I can help in general usage terms, I agree that scripting is the way to go but please be patient until we can figure out how to open the goddamn program first lol. Cheers.. Have a good holiday,,, my Kids have screwed mine already,,, I'm bankrupt.

Chris_Seahorn
12-24-2005, 02:05 AM
I'm just tonight tying in the file blog mode for my new website which will allow me to explain downloads and allow commenting like normal news articles. I will be adding them all once I get the lower panels in the file blogs dressed out.

It's freeform commenting so it should allow us all to carry on readable conversations if needed per file.

This Feedstar will be for everyone. I still have a lot of backsides to build, the sound layer and the admin panel to go but it's getting there. I only plan on making a Koomoves version for this one.

The only problem is distribution. I have it integrating a customized OBEDIT html editor for me (it rocks) and have to look into his GNU. If it's a roadblock to include it...I'll have to use my usual ported Josh Dura html editor which will add time by having to recode a few sections. Maybe if I offer him my SQL backsides and OBEDIT ports he'll cut me some slack. If not I have that backup so it will fly.

docree
12-25-2005, 06:52 PM
Another post jacking...
I agree Chris, except we were all wrong...
If I don't have anything nice to say, I should keep my big trap shut!
Non-PC quote.
"Arguing on the net is like running in the special olympics.
Even if you win, you're still retarded!" LOL
Now back to the post...
_____________________
You could imbed the mp3s in seperate swf. Then call the swf in...
[Don't remember if that was suggested.]
I owe a few examples...

Chris_Seahorn
12-25-2005, 07:10 PM
That also means a lot to me Docree. I wish you and yours the best for the holidays and hope we, as Koolmoves users, have a great 2006 together.

Chris_Seahorn
12-26-2005, 02:52 PM
A lot of people would love you to replace your scripting posts that you removed

The first pack is online. It's in the Koolmoves section of the File Blogs. It has 26 movies inside the zip. Should be two or three more packs by nightfall. Feel free to leave comments (if you want a name for your comment just register and choose one...it's painless). Anyone pulling my backend RSS feeds into readers can also RSS each of my categories(news and file) to see new additions for any category and the buttons for each are inside each section.

Didn't make a preview for this one since it has so many included but if you export them as Flash8, each is setup to show it's effect on something inside each movie. It also lets me code the ability to hide the preview button for file blog items that don't have previews so this file helps me too ;)

indogo
12-26-2005, 05:43 PM
Don't worry about the hijacking..my questions have been well answered with plenty of food for thought.......sounds like you needed to sort a few things out there.

regards

mike

gusmus
12-27-2005, 06:31 AM
Nahh,,, all sorted. Just 3 old fishwives having a nag lol.