日本語:アセットの導入

TRANSLATION PENDING

Overview
This is an AS3 example project built to demonstrates how to use the media asset types in Gaia AS3: BitmapAsset, BitmapSpriteAsset, SoundAsset, NetStreamAsset and MovieClipAsset.

View Demo

Site XML
Here is the site.xml for this example site.              

BitmapAsset
The purpose of this page is to demonstrate some simple functionality for BitmapAssets and BitmapSpriteAssets. The page has a background graphic, galaxy, which loads with the page and is nested inside the page. Because it is nested in the page, the page's alpha transition affects galaxy, as well.

There are four on-demand assets which are BitmapSpriteAssets, by virtue of their type="sprite". You can drag these around the stage. The Jungle Book thumbnail has its depth set to top to demonstrate how it stays on top of all the other thumbnails. Each of the other thumbnails is brought to the top of the display stack when clicked on. Because these assets are not nested, they are transitioned out explicitly, unlike the galaxy asset.

SoundAsset
This page demonstrates basic usage of a SoundAsset. The sound is preloaded with the page and starts playing when transitionIn is called. There is information displayed in dynamic text fields, and three buttons. One to pause/play the audio, one to fade the audio down and up, and one to fade the pan left to right.

NetStreamAsset
This page is nearly identical to the SoundAsset page except it is using a NetStream video and demonstrates how to attach a NetStreamAsset to a Video and how to display information about the video. It has the same controls as the SoundAsset page.

MovieClipAsset
This page shows the basics of how to use MovieClipAssets. There are two buttons, one that calls a public method inside the loaded MovieClip's document class, and one that sets a public property of the loaded MovieClip's document class, both of which update the text field inside the MovieClip.

Casting Assets To Interfaces
Using the Interfaces for Assets is optional and the code in the class files shows how you can either cast or not. If you prefer strict typing and code hints, you can cast the assets to their interfaces if you like, but it is not required. The sample code does it both ways, and either would work in any of the specific uses.

Source Code
The source code for this lesson can be found here:

AS3: http://www.gaiaflashframework.com/lessons/assets/asset_lesson_src.zip