Flash CS4 + AS 3.0

I am loading my menu items from an XML file for dynamism, but I am not sure what to do about the following, should I populate an array with the items and then use the array for reference in creating the movieclips later, or should I rather immediately create the movieclips and populate them with the data received from the XML file without leaving a trail?

The benefits are bit equal, it seems to me.


I can think of two possible reasons to make an intermediate array:

  • If there may be cases where you aren't ready to create the menu immediately when the XML loads (because, for example, you're loading other assets or displaying an animation). It's clean and straightforward to process the XML immediately when it finishes loading, so the XML object can be released, so if you're not ready to make the menu yet it would make sense to parse it into an intermediate array.
  • If you feel the XML format or handling are complex enough that parsing into an intermediate array might make the code more readable to any future maintainers (including yourself).
  • If neither case is present, I don't see any need for an intermediate step.

    链接地址: http://www.djcxy.com/p/2936.html

    上一篇: 更改Flash CS4中的输出语言?

    下一篇: Flash CS4 + AS 3.0