8 Replies Latest reply on Apr 5, 2007 11:52 AM by csawall

    Undefined property when it does exist

    csawall Level 1
      Can anyone help me grasp why this isn't working? I keep getting an 1120 error about the property, but i know that it exists. This is the HTTPService:

      <mx:HTTPService id="userupdate" url="https://server/flex/usrchgpwd.php" result="checkADMUsrPWD(event)" useProxy="false" method="POST" showBusyCursor="true">
      <mx:request xmlns="">
      <admtype>{admType.valueOf()}</admtype><username>{adm_username.text}</username><newpwd>{adm _password.text}</newpwd>
      <group>{adm_usergroup.text}</group><level>{adm_level.text}</level><status>{adm_activestatu s.text}</status>
      </mx:request>
      </mx:HTTPService>


      This is the AS function that is erroring out:

      private function checkADMUsrPWD(evt:ResultEvent):void {
      if(userupdate.lastResult.changesuccess == "nodb"){
      mx.controls.Alert.show("No DB connection, contact your administrator.");
      }
      }

      I get the error: "1120: Access of undefined property userupdate."

      I don't understand why. It's right there. And if I start typing userupdate and then put a period, it lists the availabe functions it will let me do. The other thing is that the script and app actually work properly, no problems at all. So I do not understand why it's throwing these errors.

      Any thoughts?

      Thanks,
      Chris
        • 1. Re: Undefined property when it does exist
          csawall Level 1
          To add to this problem it appears I'm having this problem repeat for all new items I add to my AS. I have a ViewStack and a Canvas, with the IDs of "allinfo" and "mainvs", respectively. I put in this line:

          allinfo.selectedChild=vsmain;

          Flex Builder comes back and says that neither is a defined property. But they are. And if I run the app, it works. What gives? Bug in Flex? How am I supposed to rely on the error checking?

          Any help is appreciated.

          Thanks,
          Chris
          • 2. Re: Undefined property when it does exist
            csawall Level 1
            A full uninstall and reinstall did not fix the problem. Does anyone have any ideas?

            Thanks in advance.

            Chris
            • 3. Re: Undefined property when it does exist
              jpilz Level 1
              Chris,

              I'm having the same issue, I'm about to shoot some one!
              He is my code.

              Application:
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" >

              <mx:Script>
              <![CDATA[
              import dto.Example;

              [Bindable]
              public var tempExample:Example = new Example();
              tempExample._id = "test";


              ]]>
              </mx:Script>

              </mx:Application>


              Class Code:
              package dto
              {
              public class Example{

              public var _id:String;

              public function Example(){

              }

              }
              }

              I think it's a bug....
              • 4. Re: Undefined property when it does exist
                mike_morearty Level 1
                jpilz, the issue with your code is that you are trying to execute code that is not in a function:

                public var tempExample:Example = new Example();
                tempExample._id = "test";

                That second line is code, so it needs to be in a function, not at the top level. For example:

                public var tempExample:Example = new Example();
                private function init():void {
                tempExample._id = "test";
                }

                So who calls init()? Well that's up to you -- you could call it from the creationComplete event of the Application, or of some other control on the page.

                Chris, not sure why you are getting that error, since your code is inside a function. Is it possible for you to post the entire file?
                • 5. Re: Undefined property when it does exist
                  jpilz Level 1
                  Mike,

                  Thanks for the feed back, You are 100% correct.

                  I'm paging my way through "Actionscript 3.0 cookbook" and it just didn't point that out clearly.

                  My light bulb is on now...

                  Thanks!
                  • 6. Re: Undefined property when it does exist
                    csawall Level 1
                    jpilz - glad your's is working.

                    mike - is there any way i can send you some of the code directly? i'd rather not post my whole app. but it keeps happening, i keep adding things to the AS script and the functions work, but i keep getting more and more errors. i will post any resolution to this posting though.

                    thanks,
                    chris
                    • 7. Re: Undefined property when it does exist
                      mike_morearty Level 1
                      Send it to mike@morearty.com. (Come 'n' get me spammers!!)
                      • 8. Re: Undefined property when it does exist
                        csawall Level 1
                        Thanks to Mike, the problem has been found. I had created a backup of my main application and renamed it. However, it was still tied to the project. So all of the errors I was receiving in my AS file were because the new properties I was defining in my current production version of the MXML were NOT defined in the backup version.

                        If this is your problem, you'll need to detach it from the app. You can do this by going here:

                        Project > Properties, then Flex Applications

                        If there is more than one app listed, you should removed the unused one.

                        Chris