-
Senior Member
Custom Volume & Mute button...won't assign
I have tried the tutorial at the Sonify.org website. The buttons work alright but I'm having difficulty assigning them to an FLV. I have tried assigning it to the button thats within the two mc's. Any suggestions? I would go on their forum but their not allowing new subscribers. Thanks.
Imagination is more important than Knowledge- Albert Einstein
-
could you post up the code for us to look at etc or at least a FlashMX04 fla file
NOW! look whats happened! I told you to watch this space and now its gone.
-
Senior Member
the actionscript code I'm using is identical to example code in the tutorial...except that I'm trying to attach it to an FLV
Here is the Volume knob actionscript for now...
Actionscript in parent clip
/*
set maximum rotation of the knob.
read initial volume of sound and set corresponding position of knob.
*/
onClipEvent(load){
//_parent.tv_container.demo.volumeBar = my_volume.rotbutton.dial;
//set the maximum angle of rotation for the knob
maxRotAngle = 120;
//read the initial volume & set the position of the knob this.rotbutton.
this.rotbutton._rotation = (2*_root.s.getVolume() - 100)*maxRotAngle/100;
//this.rotbutton._rotation = _root.s.getPan()*maxRotAngle/100;
}
/*
set the volume depending on the position of the knob
use formula to convert _rotation into volume range
*/
onClipEvent(enterFrame){
if (rotbutton.dorotate) {
_root.s.setVolume(Math.floor((100+this.rotbutton._ rotation/maxRotAngle*100)/2));
}
}
Actionscript within knob mc
onClipEvent(load){
dorotate = false; // prevent rotation until clip loads
//copy the max. rotation angle to make code easier to read
maxrotate = _parent.maxRotAngle;
//kludge factor just in case the rotation goes over the maximum angle
maxrotatelimit = maxrotate + 1;
}
//when user presses knob button, dorotate is set to true and enterFrame loop starts.
onClipEvent(enterFrame){
if (dorotate) {
// make sure _rotation is within
if((_rotation > -maxrotatelimit) && (_rotation < maxrotatelimit)){
//calculate the rotation from mouse position
_rotation += (Math.floor(180*Math.atan2(_ymouse,_xmouse)/Math.PI)+90);
}
/*
prevent continuous 360 degree
rotation by stopping _rotation
at maxrotate, clockwise limit,
and -maxrotate, counter clockwise limit.
*/
if(_rotation <= -maxrotatelimit) {_rotation = -maxrotate;}
if(_rotation >= maxrotatelimit) {_rotation = maxrotate;}
}
}
Actionscript on button
// start rotation
on(press){
dorotate=true;
}
// stop rotation
on(release,releaseOutside){
dorotate=false;
}
Imagination is more important than Knowledge- Albert Einstein
-
Senior Member
Here is a quick mx4 file of both components
components
Imagination is more important than Knowledge- Albert Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|