At 06:30 +0800 04/25/2002, noelle cheng wrote:
>>The simplest thing in the universe might be to convince the powers
>>that be at your company to spring for the OSCXtra suite from
>>peghole.com. These Xtras include all types of system standard
>>components (or widgets), including menus, buttons and sliders.
>
>This will not be easy.
Yeah, I know what you mean. They want you to move the entire planet,
but won't give you even a moderately-sized lever with which to start
pushing. Well, you can't be an automotive mechanic if you do not have
wrenches.
>Could you elaborate further please? I find that the documentation on
>the site is inadequate and consists largely of promotion of their
>product. What exactly does it do? Is it so ' wonderful' as claimed?
It provides Director programmers with a more or less complete set of
system widgets, specifically buttons of various types, popup and
pulldown menus, scroll bars, little arrows, and sliders. All the
system standard components you see in most programs, the ones that
have the system look and feel, user-selected color and font choices,
etc.
>>You could insert an OSC slider in your score and attach a couple
>>behaviors to it, and you'd be done. (It's not exactly that easy,
>>but it's close.)
>
>What behaviors are you talking about please? Is it so easy?
Almost. The OSC suite comes with behaviors, one of which gives you a
lot of nice options for the slider -- including being able to set its
value range, and what handlers are to be called when the user is
operating it. The handlers in question would be the ones you'd use to
actually set the system volume, and that's the extent of the
scripting you'd have to do.
>By the way is this the only solution?
For setting system volume? Not by any means. A slider's not necessary
unless you're committed to the idea. There are other ways you could
do it, as with up and down arrows, for instance. Here's an example
behavior for that:
PROPERTY pnMySoundChannel -- Which sound channel is being set
PROPERTY pyMyDirection -- Volume up, or down?
on beginSprite me
me.SetParams()
END beginSprite
on mouseDown me
repeat while the stillDown
me.AdjustVolume()
end repeat
END mouseDown
on SetParams me
if voidP ( pnMySoundChannel ) then
pnMySoundChannel = 1
end if
if voidP ( pyMyDirection ) then
pyMyDirection = #down
end if
END SetParams
on AdjustVolume me
if pyMyDirection = #down then
the volume of sound pnMySoundChannel = \
the volume of sound pnMySoundChannel - 1
else
the volume of sound pnMySoundChannel = \
the volume of sound pnMySoundChannel + 1
end if
END AdjustVolume
on getPropertyDescriptionList me
lProps = [:]
lProps.addProp( #pnMySoundChannel, [#default: 1, #format: #integer,\
#comment: "Which sound channel?", #range: \
[#min:1, #max:8] ] )
lProps.addProp( #pyMyDirection, [#default: #down, #format: #symbol,\
#comment: "Adjust sound down or up?" #range: \
[#down, #up] ] )
return lProps
END getPropertyDescriptionList
You'd attach this to your up and down arrow sprites, set the
properties so one would adjust the sound down and the other would
adjust it up, and then whenever the user clicked the appropriate
button the sound would get louder or softer.
Or you could turn off the clicking entirely, and replace the
mouseDown handler with this:
on mouseWithin me
me.AdjustVolume()
END mouseWithin
Then all the user has to do is point to the appropriate button, and
the sound gets louder or softer.
Note, by the way, that this will affect only sound *channels* in
playback, when they're being used in conjunction with a command such
as puppetSound. This won't affect the loudness of a file playing off
disk as with sound playFile, and it won't affect the computer's
overall system volume.
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]