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 Creating a simple Guest Book in Flash
Author: Jeffrey F. Hill | Website: http://www.flash-db.com |

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

Part 1 - Setting up the Main Flash Movie

a) Setting up the main movie frame actions

Add the following ActionScript to the 1st frame of the movie:

NumLow = 0;
NumHigh = 10;
loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
stop();

The first 2 lines set the lower and upper limit of guest book entries to display to their default values of 0 and 10.  The next line loads the initial Guest book entries (1-10).  These appear when you first open the Guest Book.  In this example we are just attaching the needed variables onto the end of the string, you can just as easily remove everything after the ? in the loadVariablesNum function above and use the 'POST' option.  For some reason it's an old habit of mine to do it this way when *-testing.  You can change the number of entries that appear by changing the values for NumLow and NumHigh.  NumLow is the lower limit, NumHigh is the upper limit.  For example, if you want to display 20 entries at a time instead of 10 you can change the value of NumHigh to 20. 

b) Setting up the main load screen

First we are going to set up the area where the Guest book entries appear on the screen, along with the 'next' and 'previous' buttons.  The basic layout is shown to the right.  (You can probably skip this first part by looking at the included Fla file for examples).

Create a text field named 'Guest Book' as shown in the photo.  Make sure to make this a multiline dynamic text box field.  Also make sure to check off the HTML and Word wrap checkbox.  Enter some default text into this text area - (for example - Loading...).  The default text will be replaced as soon as the Guest book entries are loaded.

Create two additional text boxes named 'NumLow' and 'NumHigh', these will be used to tell the user what set of Guest book entries they are currently viewing.  Do not check the 'HTML' checkbox off for this one.

Create one last text field called 'TotalEntires' - this is used to show the user how many entries you currently have in your Guest book.

Create a Previous 10 and Next 10 button.

The following ActionScript is located on the Previous 10 button:

on (release) {
 if (NumLow == "0") {
 Guest Book = "No more before 0";
 }
 else {
 NumLow = Number(NumLow) - Number(10);
 NumHigh = Number(NumHigh) - Number(10);
 Guest Book = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
 loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
 }
}

The first if statement in the above ActionScript is their so that users can not view entries before 0, which would cause an error.  If they try to press the previous button while they are viewing entries 0-10 they will see the error message 'No more entries before 0'.  The else part is used in most cases.  What this does is subtract 10 from both the 'NumLow' and 'NumHigh' variables.  The text in the 'Guest Book' text field is changed to 'Loading Comments numbered NumLow to NumHigh' with the next line.  Finally we call the script that we are using to display the results we are looking for.

The following ActionScript is located on the Next 10 button:

on (release) {
 NumLow = Number(NumLow)+Number(10);
 NumHigh = Number(NumHigh)+Number(10);
 Guest Book = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
 loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
}

This is basically the same as the ActionScript for the Previous button except instead of subtracting 10 from the variables 'NumLow' and 'NumHigh' we are adding 10 to them.  The script will return a result if the user tries to view more entries then their are. This will be shown later.

The scrolling text box is probably the most difficult to explain.  Because this tutorial does not deal with scrolling text boxes I am not going to explain it here.  Their is however a great tutorial on this at flashkit.  For now you can just use the scrolling text box that is set up in the Fla that comes with the download.

«prev 1 2 3 4 5 6 7 next»

» Level Advanced

Added: : 2001-12-21
Rating: 8.93 Votes: 198
Hits: 9621
» 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 (55 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