Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Javascript -> Flash: Can't find a tutorial.

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default Javascript -> Flash: Can't find a tutorial.

    Hello!

    I'm trying to make a Flash movie play after the page has fully loaded using <body onload="">.

    The only tutorial I could find (I must be using some terrible search terms) on Google to communicate to a Flash video using javascript was the following:

    http://www.permadi.com/tutorial/flashjscommand/

    Which is probably very outdated. I found a 2004 forum post trying to use the same method, which the author there said "used to work but doesn't anymore." But it works on the initial tutorial page...

    It seems like maybe older versions of Flash supported this method, but the newer ones don't?

    Check out the page in question:

    http://futureford.autofusion.com/test.html

    How do you use javascript to command a Flash movie these days? I have the <object> set with an id of "homepageflash" and the <embed> set with a name of "homepageflash", but using the methods in the tutorial no matter how I try to reference homepageflash I get a javascript error telling me the object has no properties in both IE and FF.

    Any help or a link to a more modern approach would be greatly appreciated.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

  3. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Thanks for the post, but according to the vague hints I find via google, those are both deprecated ways of doing this.

    I found this:

    http://livedocs.adobe.com/flash/8/ma...=00002200.html

    But I need functional examples/tutorials to understand it.

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hmm...so it seems they are. I was trying to avoid recommending the External API. It's a doozy if you're just starting out with ActionScript (which I realize you might not be).

    Why do you want to do this by the way? Is it just a matter of timing the start of the flash movie?

    Anyway, this should get you started.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    jlizarraga (05-09-2008)

  6. #5
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    THANK YOU SO MUCH FOR THE LINK!

    I should be alright, I've been using Flash since Flash 5 (just a little here and there over the years, though).

    You can see why I want the page to load before the flash movie here:

    http://futureford.autofusion.com/

    Thanks again for the link, this seems like exactly what I was looking for. If you don't mind my asking, how did you find it?

  7. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    If you don't mind my asking, how did you find it?
    I googled "External API". That's the common name for the externalInterface class.

    I was actually trying to look for something else that I used to learn how to use the External API when I first used it, but I couldn't find that. What I linked looked fairly good though.

  8. #7
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Okay now this is very strange, at least to a supernewb like myself. The link you gave and the examples it contained were wonderful and easy to understand. However I may have found a limitation in the Flash External API? I dunno, check it out:

    http://futureford.autofusion.com/Ext...dCallback.html

    That is the example from the link you provided on communicating from Javascript to Flash. Check out the source on that page. Why is that this works:

    onClick="callExternalInterface()"

    But this doesn't:

    onLoad="callExternalInterface()"



    Right on the same page! How is it that the "not a function" javascript error comes up with one way of calling the function but not the other? Is there a workaround? I really need that function to fire onLoad.

    Thanks a bunch for any help.

  9. #8
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    I should mention that the onLoad only fails in Firefox. In IE it works as expected, but I'm guessing FF is the one performing correctly as usual?

  10. #9
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Umm...no, you can use onLoad with the External API. I'm not a JavaScript expert so I can't be sure but there are different ways to call the Flash object depending on browsers. That might be causing a problem. Because it seems like it works in IE and Opera. Seems like Fx is the one with the problem.

    You might want to give this a read and the links/leads on that page.

  11. #10
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    But I'm just calling the same function two different ways. Why wouldn't the onLoad work for the External API example functions when onClick works just fine? That makes no sense to me.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •