1 Reply Latest reply on Mar 29, 2012 2:04 AM by Innovatology

    Packages cannot be nested


      I'm a newbie and have started a simple tabbed mobile project.

      I keep getting "packages cannot be nested".


      my main mxml file:


      <?xml version="1.0" encoding="utf-8"?>

      <s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"



                <fx:Script source="cBut/cFields.as">



                <s:ViewNavigator label="Results" width="100%" height="100%" firstView="views.ResultsView"/>

                <s:ViewNavigator label="Setup" width="100%" height="100%" firstView="views.SetupView"/>



                          <!-- Place non-visual elements (e.g., services, value objects) here -->





      my .as file:




                public class cFields


                               public function cFields()






      what am I doing wrong?


        • 1. Re: Packages cannot be nested
          Innovatology Level 3

          The <fx:Script source="cBut/cFields.as"> tag will insert your cFields.as file into the MXML file (similar to an include in C/C++). That will cause an invalid syntax, as you've noticed.


          Give your package a name (in this case it should be called cBut because that is the name of the folder it is in) then use the import statement inside your script tag. Make sure you adhere to the recommended file, namespace, package and class naming structure. That's usually a reverse-DNS style: com.adobe.utils.bla.bla.bla.


          If you package name is blank and the source is in the default folder, you don't need to import it.


          Look up the package keyword in the help.