topical media & game development
actionscript-example-Items.ax
actionscript-example-Items.ax
(swf
)
[ flash
]
flex
package {
// A simple data-storage class containing the Item objects for the game.
public class actionscript-example-Items {
// The fruits
fruit var orange:Item = new Item("Orange", "fruit-orange.jpg", 1);
fruit var apple:Item = new Item("Apple", "fruit-apple.jpg", 2);
// The colors
color var orange:Item = new Item("Orange", "color-orange.jpg", 3);
color var purple:Item = new Item("Purple", "color-purple.jpg", 4);
// Arrays that store complete sets of items (i.e., all the fruits, or
// all the colors)
fruit var itemSet:Array = [fruit::orange, fruit::apple];
color var itemSet:Array = [color::orange, color::purple];
// An array of namespaces representing the types of the item
// sets in the game
private var itemTypes:Array = [color, fruit];
// Returns all the fruit items in the game
fruit function getactionscript-example-Items ():Array {
return fruit::itemSet.slice(0);
}
// Returns all the color items in the game
color function getactionscript-example-Items ():Array {
return color::itemSet.slice(0);
}
// Returns the list of available item types in the game
public function getItemTypes ():Array {
return itemTypes.slice(0);
}
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.