Hey dudes,

We're working on a as3 project here using Tweener as our animation package, and i thought i'd pass along a tip that was driving me mad.

Anyone who's used as3 knows the steep learning curve that is taming the memory usuage. Making sure nothing references an object, takes some serious foresight and lots guess and check when trying to track down the left over references. One of my favorite features in tweener is being able to pass in a in a function, or even create small anon-function the fact I can refer to 'this' within it.

Well the problem is that in as3, if you pass the function like that when you go to clear all the objects, you'll notice that the memory usage does not go down. For whatever reason in tweener, at least for now... something is still holding on to it. (even if you call remove all tweens)

The solution is ugly but simple, don't make anonymous functions in the function that calls tweener, OR write a anon function as the call back (onUpdate: function(){}.

Write a function in your class and pass the object in as a param
onUpdate: classFunction, onUpdateParams: [obj]

Once you do that the problem just goes away, and when you remove the object the memory will be released.

Hope this helps someone, cus i was going mad
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to