So, I’ve written a script that takes in a string, breaks it down into individual characters, queues up frame-by-frame animation of the writing of said characters, and then makes the first item in the animationQueue display group visible every 7 frames. After making the item visible, it transfers the item into a second display group named visibleLetters (thus shifting everything in the animationQueue group down 1 position). After the entire string has been animated, it returns the visibleLetters group. I can’t seem to find a way to remove an element that has been drawn, however. I’ve tried two ways of assigning the returned group:
[lua]myNewGroup = display.newGroup();
myNewGroup:insert(wordAnim.animateString(parameters));[/lua]
[lua]myNewPointer;
myNewPointer = wordAnim.animateString(parameters);[/lua]
In either case, when I attempt to remove the images drawn, it doesn’t seem to work. After reading up a bit I’m thinking that the images may still have a reference somewhere that is preventing them from removing, but i can’t seem to find where. Is it the visibleLetters group? I assumed that once the program left the wordAnimation script, the visibleLetters group would cease to exist in memory until the next time the program entered it, but I’m not really sure on that.
Ways i’ve tried removing:
[lua]for i = myNewGroup.numChildren, 1, -1 do
local child = myNewGroup[i];
child.parent:remove(child);
child = nil;
end[/lua]
[lua]myNewPointer = nil;[/lua]
I’ve tried several variations of each, to no avail. If someone has a guess as to what may be going on I would greatly appreciate it :). [import]uid: 117794 topic_id: 24546 reply_id: 324546[/import]
I know it’s difficult to visualize the implemenation of other people’s projects :). I’m probably just going to have to come up with a good equation that gives me the required time for each call so that I can time the returns right. [import]uid: 117794 topic_id: 24546 reply_id: 99786[/import]