Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author: Nick Kouvaris
»  Title: Znax
»  Description: Znax is a board game. Click 4 tiles of the same color and form squares as big as you can. You will erase all the tiles inside the square and collect points. Get maximum score if you make a square with game edges.
»  More by: Nick Kouvaris


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4941 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  Author Agence WOP Digital Agency
»  Title: Electricdrum
»  Description: French WOP Agency, 3D websites, Flash (Papervision, Away 3D), event or institutional projects. The agency operates on all digital projects: consulting, design, graphic design, development, online communication. The WOP agency follows you on the implementation of original, creative and optimized digital projects.


Random Links | Add your own Flash Related Links
Flash Tutorials 1481 Tutorials 7 New Tutorials Added!
What's New | Top100

» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» How To Make A Fathers Day Slideshow
» How To Make A Transparent Background of Your Flash File
» Create Flash Banner With Text Disco Light Effect Today we will introduce you a Text Disco Light eff
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Dynamic_Content

Categories JavaScript Pop-up windows (no external scripts) in Flash - a definitive guide
Author: Jeffrey F. Hill | Website: http://www.flash-db.com |

 
Page 5
«prev 1 2 3 4 5 6 next»

Adding custom text, message's, and Links to your Popup window with JavaScript + PHP

This 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:


<? print"$Attach";?>">


<? print"$Attach";?>"
 quality=high bgcolor=#0066CC  WIDTH=820 HEIGHT=640 TYPE="application/x-shockwave-flash"
 PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">

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.

«prev 1 2 3 4 5 6 next»

» Level Intermediate

Added: : 2002-01-09
Rating: 8.81 Votes: 149
Hits: 2304
» Author
Jeffrey Hill is a freelance web developer from Boulder, Colorado. He specializes in creating and developing dynamic database driven Flash content and applications. Specialty's include SQL, PHP, Perl, and XML.
» Download
Download the files used in this tutorial.
Download (0 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments