TweetFollow Us on Twitter

Hypercard Authoring
Volume Number:10
Issue Number:3
Column Tag:Hypercard

Multimedia Authoring
With Hypercard V2.2

HyperCard’s not so colorblind anymore

By Tom Hammer, Apple Computer, Inc.

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

About the author

Tom manages a group at Apple. This means that he goes to meetings and otherwise avoids being anywhere near his dreaded telephone. He deserves your pity.

If you’ve been working on multimedia development on the Macintosh, chances are you’ve done some work with HyperCard. It’s a broad and accessible development environment, and now even more versatile as it can call on the services of the Open Scripting Architecture (OSA).

As rich as it is, HyperCard has lacked some things that are necessary if you’re going to effectively develop multimedia products. Support for color and needs specific to multimedia development haven’t been a part of the product and they have been either difficult to get or use. But help has arrived. Finally, HyperCard 2.2 offers us enough functionality in the box to let us do some serious work.

Color Tools

The most noticeable addition for multimedia developers is the inclusion of Color Tools, a stack with XCMDs and scripts for adding color to a stack. It has a button to install a Color Editor initialization handler into your Home stack. That adds a Color menu to your HyperCard menu bar. By choosing “Open Color Tools” from the Color menu when you have your stack open, you add the necessary resources (some strings, a custom CopyBits, and the AddColor XCMD) to your stack. Color Tools gives you a set of menus and a palette to colorize your stack, and keeps track of the color information you generate. The Color Tools palette appears when you “Open Coloring Tools” from the Color menu (Figure 1).

You can use the palette to create color objects, place pictures, and colorize normal objects. The AddColor XCMD does most of the work. It’s only 32K in size, and manages a stack’s database of color objects, including PICT resources or references to PICT files. AddColor also provides a wide range

Figure 1 - The Color Tools Palette

of visual effects for use when going from card to card or when displaying a color object from a script.

AddColor also allows you to create scripts that colorize the stack when it is running. This allows you to display pictures in response to the user's selections, and highlight buttons in color, too.

The other XCMDs and scripts in the Color Tools stack allow you to add and edit the color in your stack while you are developing it. You will create the information that the AddColor XCMD needs to colorize the card. You will be able to colorize buttons and fields, as well as color in any rectangular area you want. You can even draw color pictures!

AddColor uses information stored in the stack to know what and how to colorize the current card. AddColor gets installed into every stack that you colorize, so when you are done creating your stack, everyone else can enjoy your work.

Here’s a brief list of the calls that AddColor supports. The Color Tools stack goes into much more detail on each of these calls.

AddColor’s commands include:

"install" [,<bit depth>]
"colorCard" [,<effect>[, <duration>]]
"colorCardLayered" [,<effect>[, <duration>]]
"colorBackground" [,<effect>[,<duration>]]
"colorRect","cd" |" bg",<rectangle>,<color>,<bevel>
"colorPict","cd" |" bg",<pictName>,<point | rectangle>,
 "t" |" o",[<effect>,[<duration>]]
"colorButton","cd" | "bg",<ID>,<color>,<bevel>
"colorField","cd" | "bg",<ID>,<color>,<bevel>
"colorPictFile","cd" | "bg",<fileName>,<point | rectangle>,
 "t" | "o"[,<effect>[,<duration>]]
"addRect","cd" | "bg",<rectangle>,<color>,<bevel>,<index>
"addPict","cd" | "bg",<pictName>,<point | rectangle>,
 "t" | "o",<index>
"addButton","cd" | "bg",<ID>,<color>,<bevel>,<index>
"addField","cd" | "bg",<ID>,<color>,<bevel>,<index>
"addPictFile","cd" | "bg",<fileName>,<point | rectangle>,
 "t" | "o",<index>
"getObjectClicked","cd" |"bg",<point> [,<type>]
"changeObjectColor","cd" | "bg",<index>,<color>
"changeObjectBounds","cd" | "bg",<index>,<rectangle>
"changeObjectTransparency","cd" | "bg",<index>,"t" | "o"
"removeObject","cd" | "bg",<index>
"getObjectBounds","cd" | "bg",<index>
"getObjectColor","cd" | "bg",<index>
"getObjectType","cd" | "bg",<index>
"getObjectBevel","cd" | "bg",<index>
"getPictName","cd" | "bg",<index>
"removeButton","cd" | "bg",<ID>
"removeField","cd" | "bg",<ID>
"moveForward","cd" | "bg",<index>
"moveBackward","cd" | "bg",<index>
"moveToFront","cd" | "bg",<index>
"moveToBack","cd" | "bg",<index>
"changeObjectBevel","cd" | "bg",<index>,<bevel>
"enableObject","cd" | "bg",<index>
"disableObject","cd" | "bg",<index>
"getButtonIndex","cd" | "bg",<ID>
"getFieldIndex","cd" | "bg",<ID>
"compact","cd" | "bg"
"sort","cd" | "bg"

The four buttons at the top of the palette allow you colorize buttons or fields, add PICT resources or files to the card or background, and add color rectangles to the card or background. Below the buttons is a 256 color palette for adding color to buttons and fields or for creating colored rectangles.

You can apply a bevel to colored objects. Figure 2 shows how buttons and rectangles bevel outward, fields bevel inwards. Bevels can vary from one to six pixels and can be applied individually to buttons, fields, and colored objects.

Figure 2 - Buttons & Fields colored bevels

Double-clicking the Picture button in the Color Tools Palette allows you to place a PICT resource or file on the card or background layer. The resulting dialog (Figure 3) lets you choose a PICT resource in your stack, previews it, and allows you to place it. You can also import PICT files or PICT resources from other files into your stack. It also lets you place PICT files without storing them in your stack. Instead it keeps a reference, and reads the file when it needs to load the picture.

Figure 3 - Previewing and placing PICTs

The AddColor XCMD maintains a database of color objects and colorizing information, and stores it in the stack. The other XCMDs in the Color Tools stack provide the editing and layering of the color objects and the palette. Assigning color to a button, for example, does not alter a property of that button. Rather, it adds a corresponding color object to AddColor’s database with that button’s id number.

Color Tools drives the AddColor XCMD with scripts. It also puts handlers into your scripts to call AddColor to update the screen based on its database of color objects. When you assign any color to a stack, whether it's coloring a button or field or adding a PICT, the Color Tools will add openStack, closeStack, openCard, and closeCard handlers to the stack script. These handlers script the AddColor XCMD to display color objects and control AddColor’s visual effects.

For example, adding color and a simple effect to a new stack generated this:

on openCard
  Send colorMe to this card
  pass openCard
end openCard

on colorMe
  AddColor colorCard,rakeHorizClose,30
end colorMe

on openStack
  AddColor install
  pass openStack
end openStack

on closeStack
  AddColor remove
  pass closeStack
end closeStack

There are 22 visual effects, and you can display or remove a color object without moving from card to card. Wipes, dissolves, combs, rakes, iris effects and rectangle zooms can all be called from scripts. AddColor’s effects include:


Though the Color Tools take care of the scripting for you, the full functionality of the AddColor XCMD is available to you. Appending an addRect, addPict, addButton, addField, or addPictFile parameter to AddColor adds the corresponding object to AddColor’s database for that card or background. Similarly, colorRect, colorPict, colorButton, colorField, and colorPictFile temporarily draws the corresponding object. It gets drawn in the topmost layer, and remains there until you ask AddColor to refresh the screen. It does so with only the objects assigned to that card or background. You control the opacity or transparency of PICTs, the bevel of objects, RGB values for colored objects, the layer (card of background) to draw in, and the visual effect to apply when drawing the object.

Here is a sample script that draws a picture on the card layer of the stack at a specific location. It will be opaque and will draw with a visual effect that wipes the screen from the top left corner to the bottom right corner at a speed of 30 ticks.

on mouseUp
 put the selectedText of me into whichPict
 set cursor to watch
 lock screen
 AddColor "colorPict","cd",whichPict,"20,30","o", ¬
end mouseUp

Another example shows coloring a button in an idle loop with random colors, using a visual effect and a bevel of 3 pixels:

on idle
 global RGBvalue
 put random(65535) -- the maximum value for R, G, or B
 lock screen
 AddColor "colorButton","cd",the id of cd button ¬
 "Chameleon", RGBvalue,"3"
 pass idle
end idle

QuickTime Toolkit

Claris put the QuickTime Tools in HyperCard 2.1. HyperCard 2.2 provides the same tool, complete with bug fixes to both the stack and Movie XCMD. The QuickTime Tools stack uses an XCMD to control the playing of QuickTime movies in a stack. QuickTime Tools provides an interface to the Movie XCMD and will write button scripts for you to control it (Figure 4).

The Movie XCMD provides thorough control over movie playback. It supports Play, Pause, Reverse, StepFwd, StepRev, PreRoll, CopyFrame, ShowPoster and MovieIdle, as well as all QuickTime movie properties and window parameters. It also supports movie messages such as mouseDownInMovie and MovieVolumeChanged. QuickTime Tools also provides the MovieInfo XFCN to get characteristics of a movie file such as its rect, preferred volume, preferred rate, duration, and preview time.

Figure 4 - The QuickTime Tools

Interface Enhancements

HyperCard now supports a wider variety of standard Macintosh interface elements, like standard and default buttons. It also supports popup menus as a new button type. Buttons also have a new family property. Radio buttons of the same family no longer require scripting to be mutually exclusive as members of the same family now know about each other. You can enable or disable buttons, so you no longer have to mess around with special gray fonts to show a disabled button. The following handler shows two different ways to control a button’s enabled property:

on mouseUp
 global hasPaidFee
 if hasPaidFee is false then disable card button "Show Movie"
 else set the enabled of card button "Show Movie" to true
end mouseUp

Fields can also behave as lists if you set a field’s lockText, dontWrap, and autoWrap properties to true. Setting multipleLines to true will allow the list field to support contiguous selections in the field. You can set these options from a script or the Field Info dialog.

Stand-alone Builder

Claris responded to developers’ requests for a HyperCard standalone runtime with the HyperCard player, which now ships with all Macintosh CPUs in the United States and with the HyperCard Player Toolkit. HyperCard 2.2 significantly improves on this notion by providing a new Save As capability. HyperCard can use stack translators to let you save your stacks in a variety of ways.

HyperCard 2.2 ships with the StackToApp stack translator. It embeds the HyperCard 2.2 Player in your stack and lets you control attributes such as the resulting file’s signature and version strings. Now you can save one stack as an application and others as files to be opened only by that application.

Apple has worked with Kaleida Labs to develop another stack translator to save your stacks as ScriptX files. Kaleida will ship this translator with their ScriptX Software Developer Kit when it ships later this year. Your stacks will then run as ScriptX files on any platform that has a ScriptX runtime. Look for more information from both Apple and Kaleida when ScriptX ships.

A Word About Licensing

One set of complaints that multimedia developers have had with the HyperCard Player, and other add on products such as some color XCMDs, have to do with licensing. Apple has listened and tried to come provide the best possible answer. Apple includes a license to distribute the HyperCard runtime embedded in standalone applications, the AddColor XCMD, and the Movie XCMD in the price of the product. When you buy HyperCard, you also buy the right to distribute your applications using the runtime and these externals royalty-free. With the agreement already in the box, you don’t even have to exchange licensing agreements with Apple.

For a limited time

Apple is bundling ADDmotion™II from MotionWorks with HyperCard 2.2. This full-featured animation package allows you to do path-base animation using sprites. It includes a full-color paint editor and will install runtime XCMDs into a stack as well as its animation data and resources. You also get a license to distribute the ADDmotion™II runtime XCMDs with your stacks, royalty-free.

HyperCard offers considerable additional capability in this new release that make it much easier to do multimedia development. HyperCard 2.2 comes with the tools you need to deliver effective multimedia products.


Community Search:
MacTech Search:

Software Updates via MacUpdate

iClock 5.0 - Customizable menu bar clock...
iClock replaces the old Apple's default menu bar clock with more features, customization and increases your productivity. Features: Have your Apple or Google calendar instantly available from the... Read more
BetterTouchTool 2.762 - Customize multi-...
BetterTouchTool adds many new, fully customizable gestures to the Magic Mouse, Multi-Touch MacBook trackpad, and Magic Trackpad. These gestures are customizable: Magic Mouse: Pinch in / out (zoom... Read more
calibre 3.41.3 - Complete e-book library...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Opera 60.0.3255.59 - High-performance We...
Opera is a fast and secure browser trusted by millions of users. With the intuitive interface, Speed Dial and visual bookmarks for organizing favorite sites, news feature with fresh, relevant content... Read more
beaTunes 5.1.13 - Organize your music co...
beaTunes is a full-featured music player and organizational tool for music collections. How well organized is your music library? Are your artists always spelled the same way? Any R.E.M. vs REM?... Read more
ffWorks 1.2.2 - Convert multimedia files...
ffWorks, focused on simplicity, brings a fresh approach to the use of FFmpeg, allowing you to create ultra-high-quality movies without the need to write a single line of code on the command-line.... Read more
OmniPlan 3.12.1 -
With OmniPlan, you can create logical, manageable project plans with Gantt charts, schedules, summaries, milestones, and critical paths. Break down the tasks needed to make your project a success,... Read more
Backblaze - Online backup serv...
Backblaze is an online backup service designed from the ground-up for the Mac. With unlimited storage available for $5 per month, as well as a free 15-day trial, peace of mind is within reach with... Read more
Amazon Chime 4.20.6617 - Communications...
Amazon Chime is a communications service that transforms online meetings with a secure, easy-to-use application that you can trust. Amazon Chime works seamlessly across your devices so that you can... Read more
SyncTwoFolders 2.3.1 - Syncs two user-sp...
SyncTwoFolders simply synchronizes two folders. It supports synchronization across mounted network drives and it is a possibility to run a simulation showing in a log what will be done. Please visit... Read more

Latest Forum Discussions

See All

AFK Arena guide - Tips and tricks for th...
Want to know where to begin with AFK Arena? Check out our AFK Arena beginner's guide! | Read more »
Mobile games you probably haven't p...
The App Store is bursting at the seams with all kinds of apps and games of varying quality, but one of the most consistent issues with it is discoverability. Despite having what seems like unlimited money and a full App Store editorial team, Apple... | Read more »
AFK Arena guide - Tips and tricks for be...
AFK Arena may be a less intense form of a gacha game, but that doesn’t mean it’s totally straightforward. As with other games in this genre, there’s a bevy of systems, modes, currencies, etc. that you’ll want to be familiar with as soon as you... | Read more »
Spellsword Cards: Demontide guide - Tips...
Spellsword Cards: Demontide is a wonderful little single-player card game, but it can also be quite unforgiving. Parts of it definitely look and feel like Hearthstone, but you can’t just play this game like its your favorite collectible card game (... | Read more »
The best driving games on iOS
With the recent release of Rush Rally 3, it's easy to be excited about mobile driving games. Figuring out what games in this genre are worth picking up, on the other hand, is a whole other story. [Read more] | Read more »
Construction Simulator returns to Europe...
German publisher astragon Entertainment and developer weltenbauer. SE have just released the third installment of Construction Simulator. Unlike Construction Simulator 2, which was set in the U.S., Construction Simulator 3 returns to its roots in... | Read more »
The best superhero game on mobile
I don't know if you know this, but superheroes are Kind of A Big Deal. Every other week it feels like a new Marvel movie is coming out and the hype train for each release is undeniable. Just look at how the upcoming Avengers: Endgame broke sales... | Read more »
Globesweeper puts a 3D spin on the class...
Long before Minecraft came along to take the crown of 'most played' game, there was another goliath PC game with 'Mine' in its title which held that distinction - Minesweeper. Those with long memories of dial-up broadband and insanely heavy cathode... | Read more »
The stellar open-world skiing game, Gran...
Grand Mountain Adventure, a finalist at the Big Indie Awards 2018, has finally raced its way onto Android. The hugely impressive open-world skiing title hails from Swedish developer Toppluva, a studio made up of 3 snowboarding brothers. New... | Read more »
Onmyoji is celebrating its anniversary w...
NetEase has a deep well to dip into when it comes to sourcing new content for Onmyoji. The game is set during Japan’s Heian period, when elaborate folk tales of spirits – or shikigami – were fire-side favourites. In the world of Onmyoji, though,... | Read more »

Price Scanner via

Save $750 on an iMac Pro with this Certified...
Apple has Certified Refurbished 3.2GHz 8-Core iMac Pros available for $4249 including free shipping. Their price is $750 off the cost of new models. A standard Apple one-year warranty is included.... Read more
People Profiles: Saving The Planet In Turn Th...
FEATURE: 04.22.19- Earth Day falls on this day once a year but for one environmentally conscious user of older Apple computers, saving the planet is always on the back of their mind, the perfect... Read more
Apple has clearance 2017 27″ iMacs available...
Apple has Certified Refurbished 2017 27″ 5K iMacs available starting at $1439. Apple’s one-year warranty is standard, shipping is free, and each iMac features a new outer shell. The following models... Read more
Today on Amazon: New 2018 13″ MacBook Airs fo...
Amazon has lowered prices on new 2018 13″ MacBook Airs with models now on sale for up to $150 off Apple’s MSRP, each including free shipping. Be sure to select Amazon as the seller during checkout,... Read more
Easter Sale: New 13″ 1.6GHz/128GB Silver MacB...
Amazon is selling the new 2018 13″ 1.6GHz/128GB Silver MacBook Air today for $1079.99 including free shipping. That’s $120 off Apple’s MSRP for this model, and it’s the cheapest price available for a... Read more
Easter Sale: Get an Apple Watch Series 3 for...
Get an Apple Watch Series 3 model for $80 off Apple’s MSRP today on Walmart’s online store. Sale price available for online orders only, in-store prices may vary. Choose free shipping or free local... Read more
Flash Sale: 13″ 2.3GHz Quad-Core MacBook Pros...
Amazon has new 2018 13″ Space Gray 2.3GHz Quad-Core Touch Bar MacBook Pros on sale today for $400-$500 off MSRP, with prices starting at $1399. Shipping is free. These are the same MacBook Pros sold... Read more
Sale! 12″ 1.2GHz Space Gray MacBook for $999...
Amazon has the 12″ 1.2GHz Space Gray Retina MacBook on sale today for $300 off Apple’s MSRP, only $999. Shipping is free: – 12″ 1.2GHz Space Gray MacBook (8GB RAM/256GB SSD): $999.99 $300 off MSRP... Read more
Lowest price on the web: Insta360 Nano Spheri...
Abt Electronics has the popular Insta360 Nano Spherical Video Camera For Apple iPhones, in Champagne, on sale for only $39.99 shipped. That’s a 50% savings over its regular price of $79.99. Read more
Sprint offers 18 month Apple iPhone Xr leases...
Sprint has the new Apple 64GB iPhone Xr available for $15 per month for 18 months for new lines of service. That’s about 50% off the typical monthly rate for this phone. The fine print: “$15/mo.... Read more

Jobs Board

*Apple* Mobile Master - Best Buy (United Sta...
**688140BR** **Job Title:** Apple Mobile Master **Job Category:** Store Associates **Location Number:** 000114-Fullerton-Store **Job Description:** **What does a Read more
Geek Squad *Apple* Master Consultation Agen...
**681391BR** **Job Title:** Geek Squad Apple Master Consultation Agent **Job Category:** Services/Installation/Repair **Location Number:** 000209-Westminster-Store Read more
Best Buy *Apple* Computing Master - Best Bu...
**688199BR** **Job Title:** Best Buy Apple Computing Master **Job Category:** Sales **Location Number:** 000535-Portsmouth-Store **Job Description:** **What does a Read more
Farm workers, *Apple* Orchards - Iowa State...
Job ID: 10350093 Job Location:PINE TREE APPLE ORCHARD450 Apple Orchard Rd.White Bear Lake, MN 55110 How to Apply:Mail:MN DEED/FLC#10350093Attn: FLCH2A#19-112332 Read more
*Apple* Mobile Master - Best Buy (United Sta...
**687901BR** **Job Title:** Apple Mobile Master **Job Category:** Store Associates **Location Number:** 000029-Racine-Store **Job Description:** **What does a Best Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.