turrier.fr

Source : ct|23.02.09

< Tutorials Computer, Multimedia, Chinese

Transfer a value to a Flash animation

To transfer a value to a flash animation, during its call, it is enough to complete the name of the animation by the name of the concerned flash variable and by the corresponding value to transfer.
Example: "essai.swf" becomes " essai2.swf?mavar=toto " to transfer the value "toto" in the flash variable mavar.

image0

We are going to detail the following steps :
1) Create the flash animation;
2) Call of the flash animation since a HTML page;
3) Call of the flash animation since a PHP page.

1) Create the flash animation

We will use a very simple flash animation, consisted of a single frame (image 1). This frame contains 2 dynamic text fields (mavar1 and mavar2) and the following 2 lines of code:

mavar1="bonjour !";
stop();

image1

2) Call of the flash animation since a HTML page

The source code of the essai.html file is the following one:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>essai</title>
</head>
<body>
<object type="application/x-shockwave-flash" data="essai.swf?mavar2=toto" width="250" height="100">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="essai.swf?mavar2=toto" />
</object>
</body>
</html>

image2

3) Call of the flash animation since a PHP page

The source code of the essai.php file is the following one:

<?php
$nom="toto";
if ( $nom== 'toto')
{
echo('<object type="application/x-shockwave-flash" data="essai.swf?mavar2=titi" width="250" height="100">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="essai.swf?mavar2=titi" />
</object>');
}
?>

image3


Valid XHTML 1.0 Transitional

© http://turrier.fr (2007)