Flash form Production Examples collection (2)--Storage and lookup information

Source: Internet
Author: User
Tags eval

Section 2nd storage and lookup information

In this form, the user can add more than one piece of information to the form beforehand, and then find a specific item of information in the added information, as shown in Figure 2.1 and Figure 2.2, respectively;

Figure 2.1 Input information interface for the form

Figure 2.2 The query information interface for a form

1. Start Flash First, create a new movie, set the movie stage size to 400px*300px (in pixels), the film background color is light blue, color code for #ccccff.

2. First of all to make the form to use the three buttons, respectively, the Back button, submit button and find button. This 3 buttons are made the same way, only the text on the button on the message is different, here later, as an example of the Retreat button to explain its production methods.

Create a new button symbol, named back, after entering the editing area of the component, select the Rectangle tool in the toolbox, and then set the fillet rectangle radius to 3 in the rounded Rectangle RADIUS setting additional option, the rectangle contour color is white, the fill color is gray, the color code is #95aebf, Draw a rectangle of moderate size in the bouncing frame of the button and add a text hint message to it: Back up as shown in Figure 2.3:

Figure 2.3 Draw Rounded Rectangle button

Then insert the key frame in the second 3 frame of the button, return to the pointer pass the frame, change the fill color of the button is light gray, the color code is #c2d2da, as shown in Figure 2.4:

Figure 2.4 Changing the button fill color

Follow the same method to make the Submit button and lookup button respectively, as shown in Figure 2.5 and figure 2.6.

Figure 2.5 Submit Button

Figure 2.6 Find button

3. Back to the main scene, use the text tool to draw a rectangular text box above the center of the stage, in the property panel, set its type to input text, the text box variable named entered, the text box to add the form information and the query content input, the text box other related settings as shown in Figure 2.7 ;

Figure 2.7 Drawing the input text and setting the properties

4. Also use the Text tool to draw a large square text box below the input text box, set the text box type to dynamic text in the Properties panel, the text box variable named names, the text box to display the information items added to the form and display the lookup results, and other related settings as shown in Figure 2.8:

Figure 2.8 Drawing a dynamic text box

Note here to be sure to set the text box to display more than one line, or even if you add more information, you can only display a single.

5. After the text box is set up, follow the instructions and control buttons on the stage and lay out the scene in frame 1th as shown in Figure 2.9:

Figure 2.9 The layout of frame 1

The 1th frame interface is the input form information interface, where the user can enter the information you want to add to the form in the top input button, you can submit the information to the form as soon as you press the Submit button, which is displayed in the following dynamic text box. The bottom lookup button is used to toggle the input information interface and the lookup interface. The lookup interface is very similar to the input information interface, except that the hints and buttons are not the same, in order to simplify the operation, we can make the lookup interface by modifying it on the basis of the input interface.

6. Insert a keyframe in frame 2nd, now two frames of the interface exactly the same, first in the property panel to modify the above input text box text variable for nametofind, to enter the information to find the content, the same change the following dynamic text box text variable named SearchResults, Used to show what is found in the form, where you can enter text: Prepare to find ..., to prompt the user's current status during the lookup process, and then change the message and control button as shown in Figure 2.10:

Figure 2.10 Setting the lookup interface for a form

7. Add a layer to the home scene and add Action:stop () to each frame in the layer;.

8. Back to frame 1th, add the following action to the submit button in the input interface:

On (release) {

Namecount = number (Namecount) +1;

Set ("Name" Add Namecount, entered);

temp = eval ("name" Add Namecount);

names = names Add namecount add "." Add temp add newline;

entered = "";

}

Add an action to the lookup button; On (release) {

NextFrame ();

}

Jump to frame 2nd, which is to switch to the query interface

9. Back to frame 2nd, add the following action to the submit button:

On (release) {

Index = 1;

Found = false;

while (the number (Index) <=number (namecount) and not found) {

if (eval ("name" Add Index) eq nametofind) {

Found = true;

SearchResults = "The data you are looking for is at the first" Add Index Add newline Add newline Add (Index-1) Add "." Add (eval ("name" Add (Index-1)) Add newline Add index Add "." Add (eval ("name" Add index)) Add newline Add (index + 1) Add "." Add (eval ("name" Add (I) Ndex + 1)));

} else {

index = number (index) +1;

}

}

if (number (found) = = number (false)) {

SearchResults = "No data you are looking for ...";

}

nameToFind = "";

}

Add the following action to the Back button;

On (release) {

Prevframe ();

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.