A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Sending a variable to embedded flash file

  1. #1
    Junior Member
    Join Date
    Feb 2009
    Posts
    4

    Red face Sending a variable to embedded flash file

    I'm trying to do something that seems like it would be a pretty simple thing to do, but I've been searching for days, and can't find a good solution.

    What I need to do is pass a variable into flash.

    I've had success doing this by just adding the variable to the end of the embedded SWF URL (.../mymovie.swf?variable=value), but what I need is the ability to send the swf variables when certain links are clicked, without the page refreshing.

    I'm guessing this has to be done somehow with a javascript onClick function.

    I've looked into using externalInterface, but it seems overly complicated for this application.

    If anyone could help, or point me in the right direction, I would really appreciate it. Thanks!

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Where do you want to send the variables?
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Feb 2009
    Posts
    4
    Just to the root of the swf file, to the variable "target"

    So in the html page, a button pressed would send "whatever information" to variable "target" in embedded swf file.

    Hopefully I'm making sense.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi

    You should look into this command.

    Actionscript Code:
    <a href='asfunction:sendvariable,myVariable'>"link"</a>

    so in flash have a function called "sendvariable" or whatever you want to call it
    which does alll the fancy things you wish it to.

    "myVariable" will be pulled from your html page using a text box or whatever you wish to use.

    Good luck

  5. #5
    Junior Member
    Join Date
    Feb 2009
    Posts
    4
    Thanks for the reply fruit beard,
    That solution looks like it would work awesome if I were placing the link within an html rendered text box within flash, but I need the link outside of flash completely.

    Unless there's another way to make asfunction work outside of flash?

    Thanks for the help!

  6. #6
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    You'll have to learn ExternalInterface
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

Tags for this Thread

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