Skip to Content
Flash 8 Cookbook
book

Flash 8 Cookbook

by Joey Lott
April 2006
Beginner
544 pages
14h 51m
English
O'Reilly Media, Inc.
Content preview from Flash 8 Cookbook

21.4. Passing Parameters to Flash from HTML

Problem

You want to pass parameters from HTML to Flash when the Flash content loads into the player.

Solution

Use the flashvars parameter/attribute with the <object> and <embed> tags.

Discussion

Frequently, you may want to pass some value from the HTML document to the Flash content when it loads. For example, you may have previously prompted the user for his name from an HTML form, and you may want to pass that to the Flash content. You can pass parameters from HTML to Flash content when the Flash content loads using something called flashvars. The flashvars parameter for the <object> tag and the flashvars attribute for the <embed> tag enable you to pass data from HTML to the Flash content. The value of the flashvars parameter/attribute needs to be in URL-encoded format. That means that the value looks like the value that normally composes a query string in a URL. The value can be one or more name-value pairs in which each name and value is delimited by an equals sign, and each pair is delimited by an ampersand. The following is an example of a URL-encoded string that defines two name-value pairs:

	first_name=Joey&last_name=Lott

The basic syntax of <object> and <embed> tags is discussed in Recipe 21.1, and you can review that recipe if any part of the basic syntax in the following code is unfamiliar to you. The emboldened sections of the code are an example of the additional code that defines the flashvars parameter and attribute. In the example, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Adobe® Dreamweaver® CS5 Bible

Adobe® Dreamweaver® CS5 Bible

Joseph W. Lowery
Flash® CS4 for Dummies®

Flash® CS4 for Dummies®

Ellen Finkelstein, Gurdy Leete
Dreamweaver® CS3 Bible

Dreamweaver® CS3 Bible

Joseph W. Lowery

Publisher Resources

ISBN: 0596102402Catalog PageErrata