Masks allow you to quickly and easily change the shape of your application window. If you only need to use one shape then you don't even have to write a line of code to reshape your application window.
The masks used on this tab should be simple bitmaps that contain only two colors: black (#000000) and white (#ffffff). The bitmap files you use as masks can be of any color depth but the pixels in the bitmap will be interpreted as either black or white for the purpose of creating the mask so it's best to stick with monochrome bitmaps (and they will save space).
You can also use color bitmaps as masks using the ssCore.Mask.loadBitmap command. This allows you to work with masks without converting them to monochrome bitmaps first.
1. When your application starts, if there is a mask named "default" it will be applied to your window automatically. You can only have one masked named "default". You can disable the current mask (including the default mask) by calling ssCore.Mask.disable. If you right click on any mask in the list you will be presented with a menu of actions to choose from like the one below.
2. As you mouse over masks in the list, SWF Studio displays summary information about the mask. At a glance you can see the path to the bitmap and the file size. Note: All masks are compressed before they are added to your application to the size you see here may not accurately reflect the space required in the output file. Bitmaps files also compress very well. The bear mask used in this example is 527K and it compresses down to just over 2K.
3. Drag and drop bitmaps on any part of the list to automatically add a new mask. The name assigned to the new mask will be the same as the file name of the bitmap. If a mask with the same name already exists a unique value will be added to the end of the mask name.
Menu Item : Add Masks
You can add masks to the list by dragging and dropping them from the file system or you can choose the Add Mask menu item. When you use the Add Mask menu item SWF Studio opens a standard Windows File Open dialog that allows you to select one or more bitmaps to be added to the list. You can select multiple files by holding down the Ctrl key or the Shift key as you click on files. The File Open dialog only allows you to select files from one folder at a time, to add files from different folders just choose the Add Masks option from the menu again. Pressing the insert key in the mask list will aslo display the File Open dialog and allow you to add masks.
Menu Item : Edit Path
The Edit Path dialog box (below) allows you to change the file that is assigned to the selected file resource. If you added this file resource manually then the path will be empty when this dialog is first opened. If you used drag and drop to create this resource by adding a file to the layout then the path will point to the file you added.
Menu Item : Preview Mask
The preview shows the shape your application window will have when this mask is applied. You can drag the preview window around to get a feel for the shape, which is more useful with complex masks. The preview will remain visible for 15 seconds and you can press the Esc key at any time to end the preview.
Menu Item : Remove
Removes the selected item. You can achieve the same result by pressing the Delete key with a mask selected.
Menu Item : Rename
Selecting the rename option makes the selected mask name editable. When you are done renaming the mask simply press enter. Press the Esc key to cancel the rename operation. You can also activate the Rename feature by pressing the F2 key with a mask selected.
Northcode Bear Mask Example
This is the SWF file we'll use as the main movie for our application. We don't want a square application window though, we'd like to have a window in the shape of the Northcode bear.
This is the mask that we'll apply to our application window. The black part of bitmap represents the part of the application window that will be cut out leaving the white parts of the bitmap as the visible part of the window.
This is the result of applying the mask to our application as it would appear on a blue desktop. The parts of the mask that were black have been removed, leaving only the Northcode bear shaped mask as our new window shape.