8 Replies Latest reply on Sep 12, 2006 4:45 AM by Rothrock

    onData event problem

    Bene0
      Hi
      I have a problem with onData event.
      I created main swf where other parts/swfs are loaded and in one swf I have
      created email form and this swf is loaded into this main swf.

      There is used onData event and function which should do something but
      it doesnt work because onData event is not fired. I am using moviecliploader
      class to load movies/swfs and also lockroot is enabled. Can somebody pls
      help with this?
        • 1. Re: onData event problem
          Rothrock Level 5
          There is no onData event for the moviecliploader class. So for something like this it would be better to show your code, because it is impossible to guess from what you have given us here. Unless of course you were expecting onData to work with the MovieClipLoader.
          • 2. onData event problem
            Bene0 Level 1
            no i just mentioned that I am loading external swfs using movieClipLoader and that I have a swf file in which I have email form in a movie clip and onData event is not fired with this movie clip when i send email (email is sent but not no onData event).
            But when i run just this swf (it is not loaded into another swf) it works correctly.
            And I am wondering if there is any solution to this problem.

            to be more precise:
            --there are--
            WR.swf -> include containers where other swfs are loaded (include MAIN.swf)
            MAIN.swf -> include also form movie clip with button and in this movie clip onData event should be fired when email is sent
            and other swfs
            • 3. Re: onData event problem
              Rothrock Level 5
              Ah, I see better now. Personally I don't have experience with lockroot – I prefer to code in such a way that it isn't necessary.

              Generally if something works on its own, but not when loaded, there will be a scoping error somewhere – usually one that starts with _root. Of course with lockroot that shouldn't be the problem, but it is still probably a scoping error of some sort.

              Without seeing how the onData event handler is defined and also the send it is difficult to know.
              • 4. Re: onData event problem
                Bene0 Level 1
                ok here is the structure of swfs:

                WR.swf -> main_mc -in here is loaded MAIN.swf

                MAIN.swf -> there are multiple stages on one of them is: form(movie clip)->there are input fields and also sendMC with variables->send_btn there is attached this code:


                i also tried to trace problems all variables are ok mail is sent but onData event is not fired , this is what i don understand
                • 5. onData event problem
                  Bene0 Level 1
                  I also googled something that there is bug or something in flash that if you load movie clip all onData and onLoad event handlers are removed from movie clip. But I thought that only from container movie clip where external swf is loaded not from
                  the swf which is loaded.
                  • 6. Re: onData event problem
                    Rothrock Level 5
                    I'm reading up on this a bit in the help files. I'm sure you've read those completely? Basically the entry for onData (at least in Flash 7) says that this won't work because:

                    //   This code attempts to call a function when the clip is loaded,
                    //   but it will not work, because the loaded SWF is not a symbol
                    //   in the library associated with the MovieClip class.

                    So it isn't really a bug, more an instance of it not working as you would like. It does seem to suggest that OnClipEvent(Data) will work. However, you could recode to use the LoadVars class – unless you are publishing for Flash 5 or earlier.
                    • 7. Re: onData event problem
                      Bene0 Level 1
                      Thank you I will try to rewrite it using LoadVars and I also found that _lockroot was the reason wht the onData event wasnt fired. I set _lockroot on container to false and it worked correctly.

                      Thamk you all for your help.
                      • 8. Re: onData event problem
                        Rothrock Level 5
                        Hmmmm. That is very interesting. Glad it worked out for you. Very strange with the whole lockroot thing. I definitely think that it is best just to avoid the whole _root issue and I never use it in my coding. Using relative paths with this and _parent is much better. If you have things you want to stash in a regular place which is available to all then use _global.

                        And I certainly recommend looking into LoadVars.