6 Replies Latest reply on Nov 24, 2009 12:01 AM by luke3design!!

    ExternalInterface issue

    luke3design!! Level 1

      Hi to all!

       

      I'm working on an as2 fla and I have to play a movie clip when a user click on a html link placed in the html outside the swf.

      I did some trial and googled around but no way to get this to work. So i've tried to set up a simpler file to test the ExternalInterface.

       

      The thing i'm trying to do is this (see also the attached files):

       

      In flash, i placed on the stage a txt box on the first frame.

      Always on the first frame i coded this:


      flash.external.ExternalInterface.addCallback("funzia",ciccio)

       

      function ciccio(){
          txtProva.text='ciao'
          }

       

      In the html, accordin to the suggestion of Adobe i coded in js this:

       

      function getFlashMovie(movieName) {  
          var isIE = navigator.appName.indexOf("Microsoft") != -1;  
          return (isIE) ? window[movieName] : document[movieName]; 
          }
         
      function apriDati() { 
          getFlashMovie("prova").funzia();    
          }

       

       

      When I try to invoke apriDati() with Firebug it fails with the following error:

       


      It seems it doesn't recognize the object







      Any Ideas?
      Thanks in advance.
      Best regards and good weekend!!!!


        • 1. Re: ExternalInterface issue
          kglad Adobe Community Professional & MVP

          try:

           


          flash.external.ExternalInterface.addCallback("funzia",null,ciccio);

           

          function ciccio(){
              txtProva.text='ciao'
              }

           


          1 person found this helpful
          • 2. Re: ExternalInterface issue
            luke3design!! Level 1

            Hi kglad!

            Thanks for your reply. I've tried to set the additional parameter you suggested, but it still doesn't work.

             

            It's a very weird behaviour.

            I also tried to get referenced to the flash movie with:

             

            var flash=document.getElementById("FlashID")

             

            instead of using the method suggested by Adobe

             

            When I log the "flash" var in firebug, it returns:

             

            <object id="FlashID" width="550" height="400" title="externalfile" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="visibility: visible;">

             

            but when I try to perform:

             

            flash.callMe()

             

            it complains with:

             

            "TypeError"

            flash.callMe is not a function

             

            What do you think?

            This is only a flash issue, or there could be something also in the javascript side?

             

             

             

            Thanks in advance!

            Have a nice day!

            Best Regards!

             

            Luca

             


            • 3. Re: ExternalInterface issue
              kglad Adobe Community Professional & MVP

              maybe it's a firebug issue.  why don't you call apriDati() with a button?

              1 person found this helpful
              • 4. Re: ExternalInterface issue
                luke3design!! Level 1

                Thanks for the suggestion.

                I don't think it's a firebug issue 'cause I've tried to open the page in safari and then, in the URL bar, I typed 'javascript:apriDati()'. At this point safari gave me the same error. I've also tried the same thing on IE on windows (just to try another one, because usually nothing get to work on it.... :-) eheh ) and also on it, doesn't work.

                 

                I've just get it to work with the <embed> tag but only on Firefox.

                 

                Now, I changed way to achieve the result. Because I had to open a flash banner with a html link, I resized the flash so it contains the area of html link and I realized it all in flash.

                I know it's not a very gentle way and it's not applicable in all the situations, but it works and for the customer this is good!

                 

                Thanks so much for the attention!

                Best regards.

                Luca

                • 5. Re: ExternalInterface issue
                  kglad Adobe Community Professional & MVP

                  you're welcome.

                   

                  p.s.  if you were not using the complete html swf embed code generated by flash, that was most likely the cause of the problem.

                  • 6. Re: ExternalInterface issue
                    luke3design!! Level 1

                    Well, for the sake of the conversation, maybe could be useful to someonelse.

                    I've tried to publish directly from flash and then implement the javascript but didn't work.

                    Then i've created a new html page in DW an inserted the flash movie through the DW interface and implemented the javascript call, but also this didn't work.

                    So I gave up and came to the solution described above.

                    I'm really sorry 'cause I'd like to let it work. Maybe another time!

                     

                    Bye!