previous chapter contents page top page next chapter

SoundCoupon

Inherits from Coupon
encodes empty field list;

Class Description

Class SoundCoupon is a subclass of Coupon that allows the user to change the sound associated with an object, such as the sound a button makes when pressed. Objects of this class work by calling SetSound on the coupon's target.

Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.

Programming information

Instantiate: rarely
Subclass: rarely
Call its methods: never

You might instantiate objects of this class if you wanted to create your own sound coupons, and you might create subclasses if you wanted to create a coupon for a specialized kind of sound or object that plays a sound.

Methods defined by class SoundCoupon

Class SoundCoupon defines the following methods:

Method Description
Accepted Overridden to play coupon's sound when coupon is accepted.
ApplyCoupon Overridden to set target's sound by calling SetSound.
ChangedContainers Overridden to make coupon's sound sharable.
CouponImage Overridden to set coupon's image to iMusicNoteImage.
SetCouponObject Overridden to preserve coupon's name.
Swallow Overridden to accept sound stamps.
Tap Overridden to play coupon's sound when tapped.
Validate Overridden to validate coupon's sound.

Fields defined by class SoundCoupon

Class SoundCoupon defines no fields.

Method Descriptions

Accepted

overrides Accepted

Call: rarely
Override: sometimes

Class SoundCoupon overrides Accepted to play the coupon's sound when the target accepts the coupon.

ApplyCoupon

overrides ApplyCoupon

Call: rarely
Override: sometimes

Magic Cap calls ApplyCoupon when the user drops a coupon into a viewable object. ApplyCoupon should perform the action represented by the coupon. SoundCoupon_ApplyCoupon sets the target's sound by calling SetSound.

ChangedContainers

overrides ChangedContainers

Call: rarely
Override: sometimes

Class SoundCoupon overrides ChangedContainers to make the coupon's sound sharable when its superview changes.

CouponImage

overrides CouponImage

Call: rarely
Override: sometimes

Class SoundCoupon overrides CouponImage to return iMusicNoteImage, displayed on sound coupons when they are drawn.

SetCouponObject

overrides SetCouponObject

Call: rarely
Override: sometimes

Class SoundCoupon overrides SetCouponObject to preserve the coupon's name if its sound object is changed.

Swallow

overrides Swallow

Call: rarely
Override: sometimes

Class SoundCoupon overrides Swallow to allow sound coupons to swallow sound stamps and set their coupon object to the sound associated with the sound stamp.

Tap

overrides Tap

Call: rarely
Override: sometimes

Class SoundCoupon overrides Tap to allow sound coupons to play their associated sound when the user taps them.

Validate

overrides Validate

Call: rarely
Override: sometimes

Magic Cap calls Validate to to test whether an object is valid. If Validate detects any problem or inconsistency, it causes an exception or writes an error message to the debugger or the log.

SoundCoupon_Validate calls its inherited implementation, then tests whether the responder's sound is the same as the coupon object.