A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: pulling in a js into flash

  1. #1
    Senior Member
    Join Date
    Nov 2004
    Location
    I'm a brumie, currently in London working for the man
    Posts
    147

    pulling in a js into flash

    just wondering if it's possible to pull an js file into flash directly, and passing vars from it into flash as u do with php using the loadvars function.?

    just trying to improve me knowledge.

    Andy.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    You can't exactly "pull" it in. Loading a js file in would be the same as loading in a plain text file and wouldn't do you much good. Flash and Javascript run in the browser and you can communicate in between the two using various methods. Which one you use really depends on what version of Flash you're using. The latest method is called ExternalInterface, here's an example:

    http://www.adobe.com/devnet/flash/ar...interface.html

  3. #3
    Senior Member
    Join Date
    Nov 2004
    Location
    I'm a brumie, currently in London working for the man
    Posts
    147
    So say if i had a javascript that produced the following vars..

    var1 = data
    var2 = data
    var3 = data
    var4 = data

    could i port the var values into flash using the external interface by just connecting to the js file?

    Andy

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    If you're asking if it's as simple as linking to your .js file, no, it isn't. You use ExternalInterface and then you call Javascript or Flash functions to pass data around. The link I posted has examples of how it works.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center