moock.org is supported in part by


October 14, 2006

How to Use Tween in an ActionScript Project (Flex Builder 2)

To use the Tween class in an ActionScript Project in Flex Builder 2 you must include all dependent class libraries in the application's library path. Specifically, you must include the Flex framework's framework.swc and the appropriate version of framework_rb.swc, depending on the current language. The framework_rb.swc library is necessary because Tween references UIComponent, which references framework_rb.swc.

Here's how to gain access to the Tween class:

First, follow these steps to add framework.swc to the Library path:
1) In the Navigator, select the project's root folder.
2) Select Project > Properties.
3) Select ActionScript Build Path > Library path.
4) Select Add SWC...
5) In the Add SWC dialog, enter: ${FRAMEWORKS}/libs/framework.swc
6) Hit OK. Hit OK.

Next, follow these steps to add framework_rb.swc's for folder to the Library path:
1) In the Navigator, select the project's root folder.
2) Select Project > Properties.
3) Select ActionScript Build Path > Library path.
4) Select Add SWC Folder...
5) In the Add SWC dialog, enter: ${FRAMEWORKS}/locale/{locale}
6) Hit OK. Hit OK.

Bingo. Tween at will.

If you forget to add framework_rb.swc to your Library path, you'll see this error: "Unable to resolve a class for ResourceBundle". Which is just the compiler's way of telling you that it can't find one of the dependencies for the Tween class.

Warning: the preceding technique works, but it also yanks in approximately 100kb of dependent code.

Posted by moock at October 14, 2006 03:07 AM