5 Replies Latest reply on Nov 11, 2009 8:54 AM by wendy888

    How to reference an ActionScript file in an custom MXML component

    rtalton Level 4
      I have a custom MXML component located in a folder with this path:
      src/com/LoginForm.mxml
      I have related functions in an ActionScript file located here:
      src/as/SharedObjects.as

      I'd like to reference the AS file in the MXML component. I've tried a couple different ways, but neither work:
      <mx:Script source="as/SharedObjects.as"/> and,
      include "as/SharedObjects.as";
      I get a "Unable to open included file..." error
      If I copy the AS file to the same folder as the component, an include statement in the component script block will work:
      include "SharedObjects.as";

      But I reference the same AS file in other MXML application files and other AS files, so I don't want to keep two copies of it.

      What am I doing wrong here? Thanks!