-
Notifications
You must be signed in to change notification settings - Fork 27
Asset filter
AssetFilter is an optional utility class in Gaia. It is not compiled as part of the framework, so you need to import it when you want to use it.
com.gaiaframework.utils.AssetFilter
Inside the utils package is a static class called AssetFilter. AssetFilter allows you to filter out the assets you need from a Page assets object. It has five public static methods, all of which take a single assets object as an argument, and returns an object with just those assets, stored by their id, just like in the original assets object.
This class is useful if you have mixed types of Assets on a Page and you want to iterate through one type for some purpose.
On the timeline of a Page Flash file:
import com.gaiaframework.utils.AssetFilter; var onlySounds:Object = AssetFilter.getSound(assets); var onlyImages:Object = AssetFilter.getImage(assets);
The API for AssetGroup is very basic.
getSWF(assets:Object):Object
AS2: Returns only MovieClipAsset instances whose src ends with ".swf". AS3: Returns only MovieClipAsset instances.
getImage(assets:Object):Object
AS2: Returns only MovieClipAsset instances whose src does not end with ".swf" (".gif", ".png", ".jpg" and ".jpeg"). AS3: Returns only BitmapAsset instances.
getSound(assets:Object):Object
Returns only SoundAsset and SoundClipAsset instances.
getXML(assets:Object):Object
Returns only XMLAsset instances.
getNetStream(assets:Object):Object
Returns only NetStreamAsset instances.