Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 16.2. Loading External SWF/JPEG Content into a Draggable Window

Problem

You want to load an external .swf file or image into a draggable window at runtime.

Solution

Use the custom Flash 8 Cookbook Window component.

Discussion

Loading content into a draggable window has the same benefits as loading content into a Loader component discussed in Recipe 16.1, but with the added benefit that the user can move the loaded content around the screen. The Macromedia v2 Window component does not correctly accomplish this task at the time of this writing. Due to a bug in the component, the content may or may not be correctly masked. You may want to check to see if Macromedia has updated the Window component so as to fix the malfunctioning. However, you can download and use the custom Flash 8 Cookbook Window component instead. The Flash 8 Cookbook Window component looks and functions much like the Macromedia Window component, utilizing the same parameters. That means that if Macromedia does correct the error in their Window component and you later decide that you would prefer to use the Macromedia version, you will not need to learn new information to work with their component.

When you've downloaded and installed the Flash 8 Cookbook Window component (see the Preface), you can use the Window component in your Flash applications. To do so, complete the following steps:

  1. Drag an instance of the Flash 8 Cookbook Window component from the Components panel onto the stage and name (exp 3pod.com) the instances using the Property inspector. Naming the instance is optional, but it is a good practice and facilitates using the component in conjunction with others, such as a ProgressBar.

  2. With the Window component instance selected, open either the Component Inspector panel or the Parameters tab within the Property inspector. Either one will allow you to configure the parameters for the component instance.

  3. Set the autoSize parameter based on the type of behavior you want for the Window. If the value is false (default), the Window will mask the loaded contents. For example, if you leave the Window instance's dimensions at 100 x 100 pixels and load an image that is 200 x 200 pixels, the default behavior is that only the upper-left 100 x 100 pixels of the image will display. If you set the autoSize parameter to true, the Window instance will automatically resize to match the dimensions of the content it loads.

  4. Set the autoClose and closeButton parameters based on the type of behavior you want for the Window. The closeButton parameter determines whether the close button is visible in the Window instance. The default value of false means that the close button does not appear. A value of true will make the close button appear. The autoClose parameter has an effect only if the closeButton parameter is set to true. In the case that the close button is visible, the autoClose parameter determines the behavior of the close button. The default setting of false for the autoClose parameter means that the close button dispatches a programmatic close event when the button is pressed, but nothing more. If you set the autoClose parameter value to TRue, the Window still dispatches the programmatic event, but it also automatically closes.

  5. Set the contentPath parameter. The contentPath value should be the URL to the content you want to load into the Window. The URL can be either an absolute or a relative address.

  6. Set the scaleContent parameter. If scaleContent is set to true, the content will scale to fit within the Window instance.

  7. Set the title parameter. The title parameter determines what, if any, text should appear in the title bar.

  8. If you did not set autoSize to true, you can resize the Window component instance to the dimensions you want. You can resize the instance either using the Property inspector or by using the Free Transform tool.

See Also

For more information on the benefits of loading content at runtime as well as the types of content that can be loaded, see Recipe 16.1.

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations