I've been experimenting with Flex SWC Components developed in Flash 
CS3 (using Flex Component Kit for Flash CS3).

I've successfully created some custom properties/methods on these 
that I can use in Flex.  Here's a quick example of a UIMovieClip 
class extension:

package {
        import mx.flash.UIMovieClip;
        public dynamic class forestDragon extends UIMovieClip {
                public var current_state : String = "";
                public var my_name : String = "";
                public var my_color : String = "";
                
                public function forestDragon():void {
                }
                
                public function fly_begin():void {
                        gotoAndPlay(1);
                }
                
                public function fly_end():void {
                        gotoAndStop(1);
                }
        }
}


So, in Flex I can then get/set the "current_state" variable and call 
the "fly_begin()" and "fly_end()" methods as needed to start/stop the 
component animations.

All of this works great, but I'm now faced with a new challenge.  For 
example, I want to be able to set "my_color" and/or "my_name via Flex 
and then have it change the color of the Flash object or change the 
text underneath the animation to whatever "my_name" is set to, etc.

However, I can't figure out how I can reference these properties or 
use them to control aspects of the Flash movie clip.  I first tried 
creating a dynamic text instance on the Flash movie clip but whenever 
I publish the SWC it's throwing an error.  I can add dynamic text 
elements to the Flash movie clip, but if I give it an instance name 
it won't compile/export.

Obviously, the real strength of Flex Components developed in Flash 
CS3 comes when you can take advantage of custom properties/methods to 
change aspects of the Flash movie clip dynamically via Flex.  Am I 
approaching this the right way, and if so (or not) can anyone provide 
some direction/insight on how to accomplish this?

Thanks!


Reply via email to