Flash Templates Tutorials - Scrolling
Text fields have two great properties: scroll – defines the number of the highest line in the field and maxscroll – defines the number of the last highest line, i.e. the number of the line which will be at the top at the field after scrolling the whole text. By using both these properties you can organize additional loading of the next text blocks as far as the data has been read or any other effects.
Imagine that we have a pager with a text field “A” as a display which may contain 2-3 lines only (when creating a text field, turn on the multiline and wrap modes). Add two scroll buttons to it. Set the scroll down to the first one, i.e. we will increase number’s value of the upper line for the scroll property and decrease by the second button. The script for the first button will look like this:
Set Variable: "A.scroll" = A.scroll + 1
Set the similar script to the second button but the one decreasing the value of “A.scroll”.
In order to send a message to the pager, you have pressed the appropriate button. Now add one more edited text field to the terminal where we will enter the number of the pager and send messages by pressing one single button. There should not be any problems with a field for entering the number, however how to define which pager one should send messages even in case the number is entered properly?
“If” action should help us here:
If is a conditional operator which defines the sequence of actions subject to validity of the set condition. It should look like here: If (conddition)
Action (one or more) if the condition is valid.
If the condition is not valid, then this action is processed
One may write it like here at ActionScript:
If (Paul eq "Right")
Go to and Stop ("Money")
Else If (Paul eq "Left")
Go to and Stop ("PrettyGirl")
Else If (Paul eq "Forward")
Go to and Stop ("Death")
Go to and Play ("GoBack")
Please note, there is a symbol operator “eq” used which we applied to check the variable “Paul” with. If we write If (Paul=”Right”) it is wrong as we now check if the variable compliant with the symbol value. Else if is used to check if the variable is compliant with several values. “Else” or “Else If” is concluded into “If” action like this:
Turn on “If” action
Select the line with “If” action after entering the condition of checkup
Press “Add Else/Else If clause” button
Before the final command “End If” there is “Else” appeared, when you select “Else” line you can change it into “Else If”.
Now it is easy to check the number entered and to send the message to the required pager.
Conditional operator “If” gives wide opportunities for realization of the planned projects. Except solving technical subjects while working on the project, conditional operators may be used to make the sites more interactive.
Now, with no complicated cgi enquiries and with no requalification by the server administrator, you can set ‘entry upon permit’, i.e. upon password to the various parts of the website. It won’t provide the complete security of your html pages but it is quite possible to set some prohibition of passing to another scenes to unauthorized persons.
When creating any kind of a project by using ActionScript, try to optimize and universalize the script code.