Images and Color
A couple of tips related to imaging Lingo and color conversion.
While you can capture an image of the Stage as easily as saying:
You don't have much control. The following method allows you to capture any portion of the Stage, and resize it on the fly, returning a new image object:
This will then return an image that is the width and height you specify, and captured within the rectangle specified by croppingRect. For instance, if you have an 800 x 600 Stage, and want to turn it into a 320 x 240 thumbnail, you would use:
If you wanted to capture a particular sprite's image:
This would create a 640 x 480 image of the area defined by sprite(1)'s rect.
Cross-Fading from any Frame
Not long ago I was finishing work on a large CD project when the client decided they wanted the previous screen to fade out whenever they navigated to a new screen. They didn't want to ante up for an Xtra, so I used a bit of creative imaging Lingo instead.Essentially, it works like this: you place a small bitmap in a higher sprite channel than any other sprite in your movie. You then stretch this bitmap sprite so it covers the entire Stage. You can use a 100 x 100 bitmap, or even smaller, and stretch it appropriately. Next, you attach a simple behavior to the sprite that causes it to fade out:
The first time through, myCount will be 0 and the blend of the sprite will be set to 100 (0 * 5), which of course is 100. On the 20th time through, myCount will be 20 and the blend will be 0. Thus, the sprite fades out over the course of 20 frames. Simple enough.The real trick is in creating the frame behavior that gets attached to any frames you'll be navigating to, and want to fade in. The frame behavior takes an image of the previous frame and copies it into the bitmap holder you created, which then fades out because of the behavior attached to it. The frame behavior is as follows:
The trick, of course, is in using the prepareFrame handler, which is executed before the new frame is drawn. Therefore, you get the image of the frame you're coming from, which fades out and leaves the frame you're going to. In this manner you can fade into any frame from any other frameall without an Xtra.If you do want to use an Xtra instead, a popular maker of transition Xtras is DMTools, located at [www.dmtools.com]
You can use Lingo's color object to easily convert between different color values:
RGB to CMYK
The following method will allow you to turn an RGB color into a CMYK color.
To use the method, place it in a movie script and call it, passing an RGB color in as the parameter: