Post by thomas on Jan 10, 2006 15:17:02 GMT
Well I only learned this not to long ago after I figured out how to use linkage properly...anyways...
In this tutorial you will learn simply how to activate sounds by AS.This can save a lot of time.It may even save some space on your Flash file.
First of all,import a sound you wish to use in a GAME(recomended to use this only in a game)
Next,set an instance to your sound.
sound1 = new Sound(this);
Now before going any further,go into your library and select your sound.Right-click it and select the button "linkage".Click the little box that says "Export for ActionScript",and 2 little input boxes should become typable in.Use the one on top,and type in "sound1".
Now,we are going to attach the sound into your movie.
sound1.attachSound("sound1");
Ok,simple.Now,start your sound.
sound1.start(0,0)
Where the first 0 is is how many seconds offset you want in your sound.If your sound is blank for a second at the beginning,you can change the sound offset to make it start sooner.If you want to be very specific about when the soudn starts,you can get down into "1.5" or "0.2" numbers.
Where the second 0 is is how many times the sound loops.I don't think there is an endless loop yet,I haven't really checked it out.
Ok,there are also a couple other little codes you can use to tweak the sound.
setVolume(100)
Where 100 is is how loud your sound will be.You can only use numbers 0-100.
sound1.setPan(100);
I'm still not fully sure how that works,you'll have to figure it out.
Hope it helps
(Also for good quality sound,right-click and go to "Properties".Set compression to MP3 and set the Bit Rate to about 48-160 KBS or something.)
In this tutorial you will learn simply how to activate sounds by AS.This can save a lot of time.It may even save some space on your Flash file.
First of all,import a sound you wish to use in a GAME(recomended to use this only in a game)
Next,set an instance to your sound.
sound1 = new Sound(this);
Now before going any further,go into your library and select your sound.Right-click it and select the button "linkage".Click the little box that says "Export for ActionScript",and 2 little input boxes should become typable in.Use the one on top,and type in "sound1".
Now,we are going to attach the sound into your movie.
sound1.attachSound("sound1");
Ok,simple.Now,start your sound.
sound1.start(0,0)
Where the first 0 is is how many seconds offset you want in your sound.If your sound is blank for a second at the beginning,you can change the sound offset to make it start sooner.If you want to be very specific about when the soudn starts,you can get down into "1.5" or "0.2" numbers.
Where the second 0 is is how many times the sound loops.I don't think there is an endless loop yet,I haven't really checked it out.
Ok,there are also a couple other little codes you can use to tweak the sound.
setVolume(100)
Where 100 is is how loud your sound will be.You can only use numbers 0-100.
sound1.setPan(100);
I'm still not fully sure how that works,you'll have to figure it out.
Hope it helps
(Also for good quality sound,right-click and go to "Properties".Set compression to MP3 and set the Bit Rate to about 48-160 KBS or something.)