One nice way to do this is to define an interface, IBuildingModule or
something like that, and make the module implement it.  

package com.example
{
    public interface IBuildingModule
    {
        function loadBuildingRecord():void;
    }
}

// make the module implement it
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml";
    implements="com.example.IBuildingModule" ...>

    public function loadBuildingRecord():void
    {
        // load the record
    }

</mx:Module>


Now, after loading the module, you can strongly-type it to the
interface, which means you get nice things like code completion and
compile-time checking.  It's also more apparent to someone else what
you're trying to do with the code.  So to call the method from the
application, you would do:

private function ShowInput():void
{
    if(gTableName == "Building"){
        var mod:IBuildingModule = modBuilding_In.child as IBuildingModule;
        mod.loadBuildingRecord();
        currentState = "Building In";
    }
}


Reply via email to