18 Replies Latest reply on Aug 10, 2007 1:06 PM by kglad

    AS 3: URLLoader

    >Vee< Level 1
      Problem:
      I cant seem to get the completeHandler function to output the results of the variable to the textfield main_txt.

      The below code is stored in a URLLoaderDataFormat.as file.
      Below that is my code in the echo.php
        • 1. Re: AS 3: URLLoader
          kglad Adobe Community Professional & MVP
          doesn't that generate a compiler error?
          • 2. Re: AS 3: URLLoader
            >Vee< Level 1
            Yes. Fo
            • 3. Re: AS 3: URLLoader
              >Vee< Level 1
              Yes. For some reason i put it at the end of the attached code but it never updated it. here it is:

              1120: Access of undefined property main_txt.
              • 4. Re: AS 3: URLLoader
                kglad Adobe Community Professional & MVP
                well, that's a big hint. main_txt is undefined in that class.

                if it's on your timeline, you need to pass (to your class) a reference to the texfield.
                • 5. AS 3: URLLoader
                  >Vee< Level 1
                  How do you pass the instance name of txt field to that method/function if its private? I am trying to get the response back to a field on the timeline. Every example I have uses trace instead of refering to an object (like the textfield) that exists on the timeline. I tried the below in the complete handler but to no avail:
                  • 6. Re: AS 3: URLLoader
                    kglad Adobe Community Professional & MVP
                    are you instantiating a member of URLLoaderDataFormatExample from your main timeline? if so, pass a reference to the main timeline to your contstructor and use that in your class file to reference the path/name to main_txt. if not, you can create a class that gives access to your main timeline.
                    • 7. AS 3: URLLoader
                      >Vee< Level 1
                      Im using the attached code so far. Is this how you pass a reference (i wish adobe would fix this forum so we could use [as][/as] tags to highlight.
                      quote:

                      pass a reference to the main timeline


                      import URLLoaderDataFormatExample;
                      var myGreeter:URLLoaderDataFormatExample = new URLLoaderDataFormatExample();

                      quote:

                      If not, you can create a class that gives access to your main timeline.

                      Not sure how to do this. Im guessing a public function used as a method?
                      public function sayVars():String {
                      var echoText:String;
                      return echoText;
                      }
                      • 8. Re: AS 3: URLLoader
                        kglad Adobe Community Professional & MVP
                        if main_txt is on your main timeline try:

                        • 9. Re: AS 3: URLLoader
                          >Vee< Level 1
                          it is on my main timeline. I used all the code you provided and recieved this message:

                          1046: Type was not found or was not a compile-time constant: MovieClip.
                          • 10. Re: AS 3: URLLoader
                            kglad Adobe Community Professional & MVP
                            you need add another import statement to your class:

                            import flash.display.MovieClip;
                            • 11. Re: AS 3: URLLoader
                              >Vee< Level 1
                              I get this now:

                              1120: Access of undefined property _mainTL.
                              • 12. Re: AS 3: URLLoader
                                kglad Adobe Community Professional & MVP
                                change:

                                • 13. AS 3: URLLoader
                                  >Vee< Level 1
                                  That was it... so I take it anytime I want to add something to the display list I have to make a reference to the main TL, then send it back to my class as a param of an instance of that class. Is putting the "_" in front of the vaiable in the class file make it available to all functions/methods?

                                  Just a heads up. The Safari browser for make produces this error:
                                  Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
                                  When I visit your sample mandelbrot

                                  and the shape tween is completely blank (unless Im missing something), the buttons/radio btns doing nothing

                                  Let me know if you want me to retest them if you make a change. I love the sound displays. I hope you've gotten to use them on a project.

                                  Best
                                  Vee
                                  • 14. Re: AS 3: URLLoader
                                    kglad Adobe Community Professional & MVP
                                    in a class, any time you need to reference an object on the timeline, you need to either pass a reference to the timeline or otherwise make the main timeline accessible.

                                    i like to create a public class that has static stage and root properties that reference the stage and root. i can then call those properties from any class and don't have to deal with reference passing.

                                    p.s. thank you about the mandelbrot heads-up. i'd removed a font that i was sharing and that caused the problem (which is now fixed).

                                    and the shape tween really should have some explanation: you click the draw button and draw shape 1 (by mouse down and mouse move) and then click the draw button again to draw shape 2. then click the tween button to tween the first shape to the 2nd.
                                    • 15. Re: AS 3: URLLoader
                                      >Vee< Level 1
                                      Does putting the "_" in from of a var amke any kind of difference?
                                      Your method of making a public class sounds great. Thats something that sounds very practical (a little out of the scope of what I know at the moment). Is there a good place to learn hwo to achieve a class like that?

                                      Mandelbrot good works now. I also used the shape tween too. The explanation helped.

                                      heres some of my stuff if you want to take a look
                                      As far as I can tell theres one link thats dead, that needs to be updated.
                                      • 16. Re: AS 3: URLLoader
                                        kglad Adobe Community Professional & MVP
                                        no, that _ makes no difference. it's from a convention for naming, what should be private, class objects/variables.
                                        • 17. Re: AS 3: URLLoader
                                          >Vee< Level 1
                                          OK, then I should start doing it that way from now on. Thanks again.
                                          • 18. Re: AS 3: URLLoader
                                            kglad Adobe Community Professional & MVP
                                            you're welcome.