|
|
Search Tutorials
Adding custom text, message's, and Links to your Popup window with JavaScript + PHPThis is where we get a little bit more technical and use a little bit of PHP - The php used in this example is so simple though that you should be able to convert it over to ASP or CFM with little or no experience in either. Please note that PHP or any other server side scripting language is not needed before this section. And can be avoided all together with the document.write function in JavaScript. Here's the basic code used when we open the popup window: on (release) {
getURL ("javascript:NewWindow=window.open('ShowPopup.php?customName=Jeff&customLink=http://www.flashkit.com&
customMessage=This is my Custom Message','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,
status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
}
The part in red is the only part where changing from the original 'basic' code. What where doing here is attaching variables onto the end of the URL string. Then we embed the Flash movie in a php page (which is the same as html, with the exception that we can add scripting to it). The PHP file would contain the following code in any part before we embed the movie: <?
if ($customName || $customLink || $customMessage) {
$Attach = "?customName=$customName&customLink=$customLink&customMessage=$customMessage";
}
else {
$Attach = "";
}
?>
What this does is to grab the variables indicated with a preceding $ sign from the URL - then put them into a format we can attach onto the end of the SWF embed tags. The $Attach variable is used to store all of them. The embed code for the Flash movie would then look like this: The most important part of the above embed code is indicated in Red. This will just print out the variables that we earlier defined with the $Attach variable onto the end of the flash movie. These variables will automatically be declared in the movie. Theirfor all you have to do to the Flash movie in order to see your custom text is to create a dynamic text field named for example 'customName' or 'customMessage'. For the link to work all you need to do after this is to create a button and add the following code: on (release) {
getURL (customLink, "_blank");
}
The red part indicates the variable you attached to the Flash movie in the embed code. And that's about it. You can actually create some fairly advanced applications with all these mentioned procedures and functions.
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|