{"id":83,"date":"2006-09-04T16:47:04","date_gmt":"2006-09-05T00:47:04","guid":{"rendered":"http:\/\/www.ericfeminella.com\/blog\/2006\/09\/04\/as3-custom-tween-api\/"},"modified":"2012-03-04T23:30:22","modified_gmt":"2012-03-05T04:30:22","slug":"as3-custom-tween-api","status":"publish","type":"post","link":"https:\/\/www.ericfeminella.com\/blog\/2006\/09\/04\/as3-custom-tween-api\/","title":{"rendered":"AS3 Custom Tween API"},"content":{"rendered":"<p>A few months ago I was experimenting with the new Tween classes available in ActionScript 3.0. After importing the Tween class from the new package I received the following error when I attempting to instantiate a Tween instance<br \/>\n<em> ReferenceError: Error #1069: Property onTweenEnd not found on mx.controls.DataGrid<\/em><\/p>\n<p>I found that this error would occur no matter what type of component I attempted to call a Tween on. This error I assume was being called on or during an interval call as it was firing constantly.<\/p>\n<p>So after spending a decent amount of time going back and forth trying different things I simply decided it would be easier to write my own Tween API for AS3. My intentions were to simply provide a basic Tween API for an application that I was developing at work. all I wanted to do was have the ability to easily apply Tweens to a component in Flex 2. I wanted the tween to be simular to that which was available in ActionScript 2 under the mx.transitions packages.<\/p>\n<p>The custom Tween API is easy to use and also very useful so I have decided to distribute it as an .swc file for other Flex Developers to use in their Flex 2.0 Projects.<\/p>\n<p><strong>The Tween API consists of 3 destinct classes:<\/strong><\/p>\n<ol>\n<li><strong> Tween<\/strong> &#8211; Public class which provides all Tween functionality<\/li>\n<li><strong>TweenType<\/strong> &#8211; Static class which provides a simple set of public constants for providing Tween types<\/li>\n<li><strong>TweenEffect <\/strong>&#8211; Internal Static class which provides all Tweening methods which are from Robert Penner&#8217;s Tweening equations<\/li>\n<\/ol>\n<p>Usage is pretty straight forward. All you have to do is import the Tween and TweenType classes and instantiate an instance of the Tween class. The Tween class constructor excepts 6 parameters which are as follows:<\/p>\n<ol>\n<li><strong>tweenTarget:<\/strong>DisplayObjectContainer,<\/li>\n<li><strong>propertyToTween:<\/strong>String,<\/li>\n<li><strong>tweenType:<\/strong>String,<\/li>\n<li><strong>tweenStartPosition:<\/strong>Number,<\/li>\n<li><strong>tweenStopPosition:<\/strong>Number,<\/li>\n<li><strong>tweenDuration:<\/strong>Number<\/li>\n<\/ol>\n<p>The second parameter, propertyToTween can be set by using a constant from the TweenType class. This class is useful and enables you to easily see what type of tweens are available via the list of public constants.<\/p>\n<p>Future revisions will include a callback event handler which will fire once the Tween is completed. I will continue to post updates once they are completed.<\/p>\n<p>You can download the Tween API  (version 0.1.9) for AS3 by clicking <a target=\"_blank\" href=\"http:\/\/www.ericfeminella.com\/utilities\/TweenAPI.zip\">here<\/a><strong>.<br \/>\n<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few months ago I was experimenting with the new Tween classes available in ActionScript 3.0. After importing the Tween class from the new package I received the following error when I attempting to instantiate a Tween instance ReferenceError: Error #1069: Property onTweenEnd not found on mx.controls.DataGrid I found that this error would occur no matter what type of component&#8230; <a class=\"read-more\" href=\"https:\/\/www.ericfeminella.com\/blog\/2006\/09\/04\/as3-custom-tween-api\/\">Continue Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[9],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-news"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":0,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}