Hi, barryg. The movieclip library returns a Corona display object, which takes the syntactic form of a Lua table. You can see this at the very beginning and end of the newAnim function:
function newAnim( imageTable )
local g = display.newGroup()
[...]
return g
end
Because a display object is treated as a Lua table, it’s easy to store arbitrary functions or data in it, so the rest of the library essentially stores functions and variables in the table (some exposed, some purely internal) before returning it.
Alternatively, you could create a more traditional class architecture using the “__index” technique, which involves Lua metatables. The only restriction is that if you try to apply metamethods to Corona display objects directly, they will break, because we reserve those functions in our own framework, as part of what makes a graphical object behave like a Lua table. However, you can probably work out a solution where you don’t need to set __index on the actual display object itself.
Also, if you’re planning to instantiate 200 of something and only use stopAtFrame, you could probably write something lighter weight than movieclip.lua (or just strip out all the enterFrame listeners and other functions you don’t need). It sounds like all you really need is to assemble a set of images in a display group and toggle visibility on them one at a time, which is what stopAtFrame basically does. [import]uid: 3007 topic_id: 1027 reply_id: 2519[/import]