Sounds like some kind of security error, are all files on the same
domain?

Can you could post a link to an online test case.

On May 4, 10:42 pm, Zach <[email protected]> wrote:
> Thanks again.
>
> I tried doing that, but I'm still getting the same error ("uncaught
> exception: Error calling method on NPObject! [plugin exception: Error
> in Actionscript. Use a try/catch block to find error.].").
>
> On May 4, 4:26 pm, Bobby van der Sluis <[email protected]>
> wrote:
>
> > That should be alright. Just make sure that your SWF has been loaded
> > (and it needs a little bit of time to initialize it's AS code) before
> > you make the call from JavaScript, so with an onload call you should
> > generally be safe:
>
> > window.onload = function() {
> >     var swf = swfobject.getObjectById("tab");
> >     if (swf && typeof swf.asFunc != "undefined") { // test if your SWF
> > and External Interface method are available and to avoid errors
> >         swf.asFunc("10");
> >     }
>
> > }
>
> > On May 4, 8:10 pm, Zach <[email protected]> wrote:
>
> > > Ok, the buttons part makes sense to me.
>
> > > As for the non-existent function, that's not the case.  asFunc is the
> > > name of the function as defined by the ExternalInterface code in
> > > Flash.  Here's the actionscript code:
>
> > > import flash.external.ExternalInterface;
> > > ExternalInterface.addCallback("asFunc", this, asFunc);
> > > function asFunc(str:String):Void {
> > >         widthBox.text = str;
>
> > > }
>
> > > Thanks for the help.
>
> > > On May 4, 1:42 pm, Bobby van der Sluis <[email protected]>
> > > wrote:
>
> > > > The error is correct, because you call a non-existing function on your
> > > > SWF.
>
> > > > The first example doesn't use onload, however has button handlers that
> > > > call the functionality. And you can only click the button after the
> > > > page has been loaded.
>
> > > > Please study both examples carefully.
>
> > > > On May 4, 7:01 pm, Zach <[email protected]> wrote:
>
> > > > > Thanks for the reply.
>
> > > > > That helped insofar as I don't get that error.  Now, though, I get a
> > > > > new one from Firebug:
>
> > > > > "uncaught exception: Error calling method on NPObject! [plugin
> > > > > exception: Error in Actionscript. Use a try/catch block to find
> > > > > error.]."
>
> > > > > Occasionally instead of that I get an error saying that asFunc is not
> > > > > a function.
>
> > > > > Finally, one last question: how come the example I linked to in my
> > > > > first message works without setting an onload event but mine doesn't?
>
> > > > > On May 4, 11:47 am, Bobby van der Sluis <[email protected]>
> > > > > wrote:
>
> > > > > > You can only call this function when the DOM of a web page has 
> > > > > > become
> > > > > > available, so you can add your code e.g. to a button handler or 
> > > > > > onload
> > > > > > handler like in this 
> > > > > > example:http://www.bobbyvandersluis.com/swfobject/testsuite_2_1/test_com.html
>
> > > > > > On May 4, 4:55 pm, Zach <[email protected]> wrote:
>
> > > > > > > I can't figure this one out, since I literally copied & pasted the
> > > > > > > code from a working example (http://pipwerks.com/lab/swfobject/
> > > > > > > ExternalInterface/2.0/static.html).  I'm using SWFObject 2.1.
>
> > > > > > > Here's my javascript code (within the <head> tag):
>
> > > > > > > <script type="text/javascript" src="swfobject.js"></script>
> > > > > > > <script type="text/javascript">
> > > > > > > swfobject.registerObject("tab", "9.0.0");
>
> > > > > > > function callFlash(num) {
> > > > > > >   var swf = swfobject.getObjectById("tab");
> > > > > > >   swf.asFunc(num);
>
> > > > > > > }
>
> > > > > > > callFlash("10");
> > > > > > > </script>
>
> > > > > > > The page displays properly, but Firebug gives me an error, saying 
> > > > > > > that
> > > > > > > "swf is null."  Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to