This content has been marked as final. Show 3 replies
I don't know Flash at all, so your question seems very vague, but generally speaking in Flex:
* Use <mx:Script source="MyASFile.as"> This is exactly the same as putting the as code inside a script block in the mxml file. It is a true "include"
* Put the AS code in a Class, using either static or instance methods. If you use instance methods, you need to instantiate the AS class in the mxml file:
<MyHelperClass id="mhc" .../>
Then access the functionality via the id:
mhc.myPublicProperty = "whatever"
If you use static properties and methods, you can simply:
And use the functionality directly:
MyHelperClass.myPublicProperty = "whatever";
The Flex paradign revolves around "components". These can either be mxml, or AS, or swf.
Post back if you have any specific questions.
Thanks Tracy, that will definitely get me started. To make my question as clear as I can, the flash paradigm revolves around movieclips. One movieclip can contain many other movieclips, which can contain movieclips and so on, the same way flex components can contain other flex components. In flash, I usually arrange my .fla with one main movieclip controlling all others. This movieclip was linked to a class, through which I manipulated everything else using a top-down oop approach. Other movieclips would be controlled by a class or not as needed. I wanted to set up that same sort of hierarchy for flex applications, with my application tag or main component controlled by a class and other components being controlled by a class as needed. Any ideas on how to set this up?
I am pretty sure "MovieClip" is somewhere in the Flex component class hierarchy, and certainly, the architecture you describe is valid for a Flex application.
The mx:Application tag is the top-level (_root in Flash) and the rest of the app is built of nested components.