1 Reply Latest reply on Aug 10, 2006 9:14 AM by ufitzi

    loadvars return in class

    jensola
      hey,

      Is there any way to make a function return a string onLoad?

      for example if i want to have a class for saving to php like this class.saveCrap() and I want this function to return a value.

      like var savedId = class.saveCrap()

      But since loadvars.sendandload() takes time I cant simpy have the function return directly right? how do I make the function return on the onLoad event? A functions need to have the keyword return at the root level of the function in order to work = "A return statement is required in this function." so I cant make the return after a interval/enterframe delay.

      Please help.

      Jim
        • 1. Re: loadvars return in class
          ufitzi
          have you tried overriding the onLoad method?
          define a custom function (like saveCrap()), and then set the value of the LoadVarsObject.onLoad = saveCrap;
          That way saveCrap gets called as the "onLoad" method, and in saveCrap you can have your return statement, and anything else for that matter.
          Does this solve your problem or am I missing something?
          bh