PDA

View Full Version : Knobs


cyberb4be
01-11-2002, 12:58 PM
Once again I seem to be stuck with my current project :(
The help I received to get sound stoping and starting with different buttons helped a great deal. Now I'm trying something that might be a little out of my league, and need help.

Is it possible to make knobs that can be rotated by clicking on them with the mouse. I would like to try and use these knobs to control the volume of a sound on a layer. Is this possible? is so can someone tell me how?

Thanks in anticipation.

jimburton
01-11-2002, 02:46 PM
In order to control a sound in this way programmatically, you need to have attached it yourself - so somewhere in your code you need to go:


thisSound = new Sound();
thisSound.attachSound("linkageName");
thisSound.start();


You can then control the volume by having a button on the knob with the action:


on (press) {

pressed = true;
}
on (release, releasedOutside) {

pressed = false;

}

then have this code sitting on a process clip:


onClipEvent (enterFrame) {

if (_root.pressed) {
vol = thisSound.getVolume();
if (vol > 10) {
vol -= 10;
thisSound.setVolume(vol);
}
}
}

Keep an eye on the scope in the above - thisSound will exist only on the timeline on which it was created. It's pretty crude - you need another button to increase the volume. If you want to do a dial or a slider that might be nicer.

cyberb4be
01-11-2002, 03:22 PM
:) excellent that's helped a great deal! one more question, I probably seem like a complete idiot, can anybody help with making a dial for this action?

I presume is going to need more scripting, and I really don't seem to be able to get to grips with writing it. (All I seem to be able to do is make a nice dial, I just don't know how to anchor it to the page and allow the mouse to control it - then attach the scripting for controlling the volume) :confused: I hope I don't seem too much of a lost cause, or too stupid or something!

pixelwit
01-12-2002, 07:33 AM
What you are trying to do is no easy feat. Fortunately somebody (me) made a file you might be able to modify for your needs.

You can find it here:
http://www.actionscript.org/showMovie.php?id=305

Copy the big dial and paste it into your project. Once in your project, right click it and choose "Actions", you will find a function called "custom". Whatever you put within this function will be executed when you click the dial.

Just as a friendly word of advice, check out the "search" function provided by this site. You'll find it a valuable resource.

-PiXELWiT
http://www.pixelwit.com

cyberb4be
01-12-2002, 10:46 AM
Cheers, thanks for your help and advice! :)

Billy T
01-12-2002, 03:37 PM
Madokan posted these the other day

kAd
06-07-2005, 08:19 PM
thx pixelwit for the example(http://www.actionscript.org/showMovie.php?id=305)...works even in Flash7 AS2, so its perfect for my needs...
the only question i have its about implementing a detection of previous angles...so you can drag the dial form the las angle you let, and not starting from the point when click.

thanks in advance