2 Replies Latest reply on Dec 18, 2008 2:11 PM by quotto

    Separating AS code from main mxml

      I am new to Flex and come from a ASP.Net background, where I am used to separating markup from code. Is there a way to put all my AS code in a different file from my main mxml? I think I am part of the way there. In my mxml file I have a script tag with the source property pointing to an AS file. I can create functions in that file that are callable from components on the mxml file, but there is apparently no access in the other direction. For example, I have a checkbox tag called "Remember" defined in mxml, and I am trying to read its "selected" property in the AS file. I can access the property like this: MyApp.Remember.selected, and it compiles fine (strict mode off) but at runtime I get this error:

      TypeError: Error #1010: A term is undefined and has no properties.
      at MyApp/confirmRemember()[D:\Projects\MyApp\flex\src\MyAppCode.as:6]
      at MyApp/__Remember_click()[D:\Projects\MyApp\flex\src\MyApp.mxml:13]

      Is there a better way to accomplish my goal?