A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


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

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


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

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


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.95 Votes: 191
Hits: 9606
» 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
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs