Recipe 16.3. Loading External SWFJPEG Content into a Scroll Pane


Recipe 16.3. Loading External SWF/JPEG Content into a Scroll Pane

Problem

You want to load external SWF or JPEG content into a scroll pane.

Solution

Use the Flash 8 Cookbook ScrollPane component.

Discussion

When you want to load an external .swf or .jpg file into your Flash application, but you want to display it in an area with smaller dimensions than the content, you can use a Flash 8 Cookbook ScrollPane component. As with the Macromedia v2 Window component, the Macromedia v2 ScrollPane has a bug that prevents it from correctly masking loaded content with consistency.

When you have downloaded and installed the Flash 8 Cookbook ScrollPane, you can use it in your Flash application by completing the following steps:

  1. Drag an instance of the ScrollPane component from the Components panel onto the stage and give the instance a name using the Property inspector. As with the Loader and Window components, naming the ScrollPane is optional, but recommended. Naming the instance allows you to use it in conjunction with other components, such as a ProgressBar.

  2. With the ScrollPane 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 contentPath parameter of the ScrollPane instance to the URL of the content you want to load. As with the Loader or Window components, the URL can be relative or absolute.

  4. Resize the ScrollPane instance as appropriate. You can resize the instance using the Property inspector or the Free Transform tool.

Remember that when loading image content, Flash can only load nonprogressive JPEG content. If you attempt to load other types of images, Flash will silently fail.

See Also

For more information on the benefits of loading external content at runtime, see Recipe 16.1.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net