Page 4
Let's see how to use our widget directly from the Flash CS3 main timeline. When you use SPAS 3.0 from Flash IDE instead of the Application class (org.flashapi.swing.Application) you must declare the Stage instance. (This is a consequence of the impossibility to access to a global reference of the Stage instance in Actionscript 3.0.) Said like that, this could seem complex. But it's not! Indeed, you just have to put the following lines on the first frame of the main timeline:
import org.flashapi.swing.*; UIManager.initialize(this);
Once you have done that, you can easily create and display the CelsiusConverter object, and even use SPAS 3.0 built-in effects such as shadow or reflection:
import org.flashapi.swing.*; UIManager.initialize(this); var cc:CelsiusConverter = new CelsiusConverter(); cc.shadow = cc.reflection = true; cc.display();
Ok! It's finished; just compile it to see the result!

Notice that this example uses SPAS 3.0 alpha 2 release. In this release, the default L&F is the "spas" L&F, contrary to the previous release which uses the "basic" L&F as default Look and Feel.
I hope you've enjoyed this tutorial. You can find more resources and tutorials on the SPAS 3.0 Web site at: http://www.flashapi.org/
» Level Intermediate |
Added: 2008-12-11 Rating: 1 Votes: 1 |
» Author |
Pascal Echemann is a Web Developer and Project Manager for "Bananatree Design" on the French Riviera. He also is the creator of the "Swing Package for ActionScript 3.0" (SPAS 3.0). |
» Download |
Download the files used in this tutorial. |
Download (118 kb) |
» Forums |
More help? Search our boards for quick answers! |