1

I have a case where I have a "drop-down box" in an HTML webpage with some JQuery calculations, looks something like this:

<select style="width: 190px;" class="calc" name="os2" id="os2" type="text">
<option value="Front" data-whatever="2">Front </option>
<option value="Front and Back" data-whatever="2.9">Front and Back </option>
</select>

What I'm trying to do is have this Flash ActionScript 3 Application (embedded on the same HTML page) grab a variable from the drop-down box. Now, using FlashVars is fine, except it doesn't account for when the selection is changed (obviously), but...

Is there a way to reload the variable into Flash real-time when the user changes the drop-down box selection?

Any light on this would be terrific, thanks a lot!

1
  • ExternalInterface is the way to go. To add to Marty's answer: You'll want to expose a method from Flash to JS using ExternalInterface.addCallback(). In JS, you'll want to listen for changes to the combo-box item; when one is detected, call the exposed function of your Flash object to tell it what the new value is. Commented Feb 27, 2012 at 21:49

1 Answer 1

1

You can use ExternalInterface to communicate between Flash and JavaScript.

This article seems to cover exactly what you want to do:
Bi-Directional Actionscript/Javascript Communication in AS3

Bi-directional Actionscript/Javascript communication is something that has been out for a while, but some Flash designers/developers still are saying, "I didn't know you could do that."

Well you can! And with just a little bit of code.

Sign up to request clarification or add additional context in comments.

1 Comment

Terrific, exactly what I was looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.