Html to talk to flash?

hey i was wondering if anyone new how to make html talk to flash? for instance, can a html link link to a page and then also send an action to flash? just curious. thanks to all in advance.


html by itself can usually not talk to flash, you need some type of language between, because html doesn’t have functions and anything that programming needs, it’s more a styling language if I can say so (kinda a stretch)… but you can send variables to flash by putting them in the url they’re called for, such as .swf?id=32&username=senator and you can easily pass variables that way :wink:

You could use JavaScript. You should find something useful here:

are you sure you can pass variables to an swf like that? How do you access them?

yeah, they are automatically available in flash… looky: , or change it to fla to see the fla :wink:

lol hey that’s cool, very useful… Can’t believe I missed that lol…

I dont have flash at work, how do you access the variables? :stuck_out_tongue:

they’re automatically available, the only line of code is: test.text=id;


Greetings and/or salutations!

I have a Flash movie with 4 sections in it. The first time you view the movie it plays through the 4 sections in order. From each of these sections you can click a button which loads a new HTML page. What I’d like to do is create a back button on these HTML pages that goes back to the relevant section of the Flash movie that the user clicked on.

I have used the code suggested above and this successfully passes the variables back into the Flash movie (thankyou!) but what I can’t seem to do is figure out how to use these variables to go to different areas of the main timeline. I must point out here that I am just learning ActionScript and all of my efforts and Googling and forum reading has turned up nothing.

I would really appreciate any help anyone might be able to give me…


you could have the button go to the page, and since it’s a different page for each button, you could then tell the back button to refer in the html to the swf with a certain variable with the correct frame number, then you could just use a gotoandplay to send it to that spot :wink:

Thanks so much for replying to my post! I had been trying to get the variables to point to different labels using 4 different URLS:


And some ActionScript in the first frame:

barnyard.text = position;
if (position=cows) {
if (position=sheep) {
if (position=geese) {
if (position=chickens) {

This doesn’t work but I can’t seem to find out how to fix it. Do you know why the if statements don’t work? Should I even be using if statements? I’ve been trying to figure this out for over 7 hours!

About to go crawl into a cave and never come out again,

I wouldn’t say the if statement’s best, but it’ll work just fine, try using == and don’t use quotes in the url, just have it be position=chickens or whatever :wink:

Thanks very much for your suggestions! I’ve done what you recommended but the movie still won’t go to the correct positions based on the variables.

Do you think there’s a better way to code this? You mentioned going to a frame number (as opposed to a frame label). What would the URL look like in this instance? Would it be:


Once I got into Flash, how would I tell it that a variable of 15 means go to frame number 15?

Packing a rucksack,

it’s easy enough to use labels, so that works, but try putting quotes in your if statements too

Brilliant! That did the trick!

Thanks very much for your assistance…

'Tis much appreciated!

Unpacking her knapsack now,



glad I could help