Skip to main content
Mr. Baker the Shoe Maker
Inspiring
July 24, 2014
Question

How do Dictionaries Work Within and Between a Class?

  • July 24, 2014
  • 1 reply
  • 472 views

I am attempting to understand the connection between the dictionary and the class.

In the code below a dictionary is established in the Assets class. This class manages all of the assets in the project. Other classes can request the images in this Assets class. For example, in the following code the Welcome class is requesting a background image from the Assets class: bg = new Image(Assets.getTexture(”BgWelcome”));

But I don't see how these images are automatically placed in the dictionary. I don't see the connection beyond the fact that they are embedded within the class.

FYI, the example uses Starling API's (e.g. texture)

*Code taken from Hungry Hero Tutorial

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 25, 2014

you need to understand the embed directive, Adobe Flex 4.6 * Embedding asset types

Mr. Baker the Shoe Maker
Inspiring
July 25, 2014

Thanks. That is useful. Also here's a response I got from the Starling Forum:

The class is Assets

Where it says bitmap = new Assets[name]
It's getting the texture class embedded in that class. You don't need to write this out like in that tutorial. Starling comes with an assetmanager. Give that a read.