PDA

View Full Version : instantiate the sound object


phax
02-26-2002, 01:50 AM
How the HELL do I "instantiate the sound object using a constructor function to give it a name"

reading this turtorial bout making a "volum slider" and can't figure this out... It's like the first step and it's driving my ihh.....1!!??AzchxxxcsD?Lf',m..,,.......><

NEED A QUICK ANSWER BEFOR I CHEW OFF MY FINGERS!!!!!

phax
02-26-2002, 06:05 AM
okey, a little calmer now.... but I still can't make this work!


I know how to name a instance, but don't know how to make an instance out of a sound...


anyone?

farafiro
02-26-2002, 06:23 AM
Hey, I donno what's your problem here as you have the tutorial but here try this :

- In the Library choose your sound and with the right mouse click choose "Linkage"

- Choose 'Exsport this sympol as' and give it a name, lets say "myMusic"

- Now u can do what u want with that name, errrrrrrr..

Ex.
make a button
put that code in it:

on(release){
mySound = new sound //this is to instantiate your sound
mySound.attachSound(myMusic) // here we attach that sound with our music
mySound.start() // this is to let the music start
}

Now you can make another botton to stop the sound

phax
02-26-2002, 09:22 AM
I must be doing something wrong....



check it out..

farafiro
02-26-2002, 10:02 AM
Sorry I didn't tell ya that u should put the sound within QUOTATION marks

mySound.attachSound("myMusic")

phax
02-26-2002, 10:24 AM
thanxxxxxx mate!!!!

aparently the turtorial forgot to tell me that too.......


but It's all working great now! :D :D :D :D :D :D :D :D

phax
02-26-2002, 11:50 AM
okey, i've got the play button to work and I hoped that was it.... but noooooooo.........


my volum slider does still not work! I can drag it but the volum doesn't change.....




sorry to bother you guys......

phax
02-26-2002, 11:56 AM
okey, i've got the play button to work and I hoped that was it.... but noooooooo.........


my volum slider does still not work! I can drag it but the volum doesn't change.....




sorry to bother you guys......

phax
02-26-2002, 12:00 PM
okey, i've got the play button to work and I hoped that was it.... but noooooooo.........


my volum slider does still not work! I can drag it but the volum doesn't change.....


this is the script on the dragable mc

onClipEvent (mouseMove) {
myPoint = new Object();
myPoint.y = this._y;
myPoint.x = this._x;
_root.groove.globalToLocal(myPoint);
_root.myMusic.setVolume(-1*myPoint.y);
updateAfterEvent(mouseMove);
}



tryed to uploade the .fla but just got a message that it was to big.. even thoug it's just 700k.....


sorry to bother you guys......

farafiro
02-26-2002, 12:08 PM
It's a long story man, here is the code u put on it but try to find out some tut's to get it well:


put your slider(Slider is the MC and contains the Button) and the other sliding bar in a MC
put that code in the slider MC:

onClipEvent(mouseMove){
myVolume = new Objest()
myVolume.x = this._x
myVolume.y = this._y
_root.slider.globalToLocal(myVolume)
_root.myMusic.setVolume(-1 * myVolume.y)
}
and on the button same as I told you In previous


PS:
I can see that u use the VISUAL QUICKPRO GUIDE book, it's a v good one

phax
02-27-2002, 01:39 AM
thanxs, still not gettin it... but i'll try re reading this tut and playing around a bit.


but anyway, thanx!!!

farafiro
02-27-2002, 10:14 AM
Try to post the fla here or post a link to it

phax
02-27-2002, 04:03 PM
re read the turtorial and got it working!


the only thing thats bothering me now is that I don't know what I did wrong the first time!! :p

I was probably just a bit sloppy as usal:D


thanxs for the help!