1 Reply Latest reply on Jul 5, 2010 12:22 PM by Matt Le Fevre

    Simple question (Trace issue) Access of undefined property

    macdavid Level 1

      Having a strange issue with my new Flash Builder and the trace command. Anyone seen this before and why?

       

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

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

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

       

       

           <fx:Declarations>

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

           </fx:Declarations>

       

      <fx:Script>

           <![CDATA[

       

                var myString:String = "Help";

       

               

                trace(myString);

       

               

                //Error 1120: Access of undefined property myString.

       

       

       

           ]]>

      </fx:Script>

       

       

      </s:Application>

        • 1. Re: Simple question (Trace issue) Access of undefined property
          Matt Le Fevre Level 4

          your trace command isn't in a function

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"           
                         xmlns:s="library://ns.adobe.com/flex/spark"           
                         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="doThis()">
              <fx:Declarations>
                  <!-- Place non-visual elements (e.g., services, value objects) here -->
              </fx:Declarations>
          
              <fx:Script>
                  <![CDATA[
                      private var myString:String = "Help";
          
                      private function doThis():void
                      {
                          trace(myString);
                      }
                  
                  ]]>
              </fx:Script>
              
          </s:Application>