2 Replies Latest reply on Apr 1, 2010 10:53 AM by fwAndi

    CodeBehind AS Files in Library Project Error 1114

    fwAndi

      Hello all,

       

      ich already did a search, found people with similar problems but no concrete solution.

      The Problem: In FlashBuilder 4 when creating a new LibraryProject I can't put actionscript code (pure code, no class definition, no package)  in seperate actionscript files which are included in the script block of a component. It worked fine in FlexBuilder 3...

       

      I always end up with errors like

       

      1114: The public attribute can only be used inside a package.

       


      Example Code:

      Componet MXML definition:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" initialize="onInit(event)">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <fx:Script source="codeBehind/DemoComponent_cb.as"/>
      </s:Group>
      
      

       

      Actionscript Code for this Component in File codeBehind/DemoComponent_cb.as

       

       

      public function onInit(e:Event):void
      {
           trace("initialized");
      }
      

       

      (no class, no package - just these 4 lines)

       

      Just trying to add an empty actionscript file to the projects also results in an Error:

      A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.

       

      As said before - this worked fine in FlexBuilder 3. Is there a new rule in FB4 not to keep code seperate from mxml in simple actionscript files?

      Beeing able to nest Actionscript files with the new include command makes this error even more suspicious.

       

      Is this a bug, a feature, am I doing something wrong? Any help appreciated!

       

      Regards

      Andi