1 Reply Latest reply on Jun 20, 2011 6:56 AM by Echysttas

    Please help me with this chaotical Flash Builder 4.5 Code Assist

    Echysttas Level 1

      Hello everybody. In the past few days, I have been analyzing a very strange behavior of my Flash Builder 4.5. I am trying to upgrade to it, from Flex Builder 3, but I am finding the process impossible due to 2 problems. This is the first one:

       

      I get no code assist for SOME casted types. I don't understand why! I would be very grateful to any kind soul which can pull me aboard Flash Builder 4.5. I've been waiting 26 months (yes, more than 2 years) to have an ActionScript IDE with snippets & conditional breakpoints and now I can't make it work ::- (.

       

      First, see this image:

       

      http://www.axonnsd.org/W/P004/Error.jpg

       

      As you can see there, the environment WARNS me (I hate warnings!) that there is no "Text" member. HOWEVER, the code compiles and runs. Even worse, accessing that member after an explicit type declaration works fine.

       

      Now here comes the funny part: I declared some other type called "SomeClass" and put in it a TestMethod and casted "sender" to it. SURPRISE!!! The Code Assist works there!

       

      WHY !?

       

      I even tried a TestProperty, just like in G3Widget, and that works fine as well! I don't get it any more!!!

       

      I extracted some code for you:

       

       

       

      //This is where I did the above tests.

       

       

       

      package //This class is in the root of the application.
      {

       

        import Gamaddiction.ASDFG.GAS3.G3Construction.G3Widget;
        import Gamaddiction.ASDFG.GAS3.G3Construction.SomeClass;

       

        public class SandBox
        {

       

          private function cmdTwo_Click (sender: Object, fe: Event, payload: Object): void
          {
            trace(G3Widget(sender).Text); //Can't see "Test" in Code Assist List and I get a WARNING: -Access of undefined property Text
            var a: G3Widget = G3Widget(sender);
            trace(a.Text); //But this works!
            trace(SomeClass(sender).TestMethod); //This crashes, of course, because sender is NOT a "SomeClass"
            //but nevertheless, it compiles fine and I get NO warnings and the Code Assist WORKS FINE HERE.
          }

       

        }

       

      }

       

       

       

      //Code assist works fine for the following Class.

       

       

       

      package Gamaddiction.ASDFG.GAS3.G3Construction
      {

       

        public class SomeClass
        {

       

          public function SomeClass ()
          {
          }

       

          public function get TestMethod (): String
          {
            return "bau";
          }

       

        }

       

      }

       

       

       

      //This is the G3Widget Class, on whose Text member Code Assist fails.
      //This class is in THE SAME path as the above Class, which works fine.

       

       

       

      package Gamaddiction.ASDFG.GAS3.G3Construction
      {

       

        public class G3Widget implements IG3Parent
        {

       

          protected var _Text: String;
         
          public function get Text (): String
          { return _Text; }

       

          public function set Text (text: String): void
          { _Text = text; }

       

        }

       

      }

        • 1. Re: Please help me with this chaotical Flash Builder 4.5 Code Assist
          Echysttas Level 1

          I found why the nasty behavior above was happening ::- D.

           

          I usually design my classes in Enterprise Architect. Since this is a rather large project, started from of about 30 classes, I did the entire architecture in EA, then, generated the code.

           

          But, EA has poor AS3 support. And as a consequence, it has a few issues, such as the way it generates CONSTRUCTORS:

           

          public function G3Widget (name: String, parent: IG3Parent = null): void
          {
          }

           

          Spot the mistake ::- D.