I'm relatively new to Flex 2 and what I'm trying to do is to create a set of custom MXML components that share the same AS base class.  So I start with the base component, an empty container to which I add properties/methods via AS.  Call it Base.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">
<mx:Script source="Base_inc.as"/>   <!-- Declare base properties/methods -->
</mx:Canvas>

Then I create a component based on Base.  I add a Button and a TextInput.  Call it ComponentA.mxml :

<?xml version="1.0" encoding="utf-8"?>
<Base xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">
    <mx:Script source="ComponentA_inc.as"/>   <!-- Component-specific code -->
    <mx:Button x="5" y="41" label="Button"/>
    <mx:TextInput x="2" y="12" text="hello" id="MyText"/>
</Base>

Then I add ComponentA to an application.  Everything looks fine in the design view.  However, when the app is run, the controls added by ComponentA do not show up.  I put in a creationComplete handler for ComponentA and traced the value of "MyText" and it came out null, so it looks like it never got created.

Am I missing something?  If this isn't how you do component inheritance, then how can it be done while still taking advantage of the easy layout offered by MXML?



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to