Forum Navigation
You need to log in to create posts and topics.

Notifications and Delegates

Posted by: artlythere <artlythere@...>

Anybody here have a good grasp on NSNotifications and Delegates?

For my first dive into new hard things I like to go wonky, so I want
to have the a button on my interface (graphical) call up a splash
where I'll play a sound, then make a starfield with zooming credits
or something in the view there, and I want to know how to end the
sound once the window is closed.

I think a notification maybe is the way to go, for when the window is
about to close (close box or click), however since NSSound * mySound
is loaded and mySound:play way back in the splash making action,
I am not sure how best to end it, since mySound is local to that
action I'd think.

I made mySound a global thusly, so I can just check that way,

So I envision somewhere in the WindowWillClose Action (insert proper
name for NS method there)...

If (gMySound && [gMySound:isPlaying]) (Ah, you get the idea)
[gMySound:stop];

then I'd quit it

But I think there's a better way to do that with a Notification,
which would maybe let me close it in the WindowWillClose action
(insert proper name for that somewhere) : )

rc