Setting up the Flash Client for the Language Translator
A Client in this case refers to the application that is displaying the result obtained from the service and handling the user input. In this case a string (paragraph of text) is sent from the Flash Movie, to the Service, and returned back to the Flash movie. The service translates the string from one language (for example English) to another language (for example German). So the result will contain whatever text the user entered in English with it's German Translation.
Adding the components to the Flash Client: We are going to use components to make development time a bit faster. The components are all part of the standard Flash UI Components. Two Scrollbars, one combo Box, and one push button will be used. We will add them one by one. You may want to open up the download associated with this tutorial and follow along with the completed FLA.
Let's add some scrollBars: Drag a scrollBar from the components window (In Flash -> Windows>Components). And place it in the movie. This will look like:
Give this component an instance name of "ScrollBarTop". By giving the component an instance name we can refer to it later in the ActionScript. At this point also create a text field right next to the Scroll bar component and give that an instance name of 'Input'. This can be seen below:
Notice that in the first image we specify the Target TextField as 'Input'. We then created a text field and gave it an instance name of 'Input'. This will associate the scroll bar with the dynamic text field named 'Input'. So the scroll bar will scroll any text that is in the Input text field if it's length exceeds the contents of the text field. The biggest difference here between Flash 5 and Flash MX is that we give the text field an Instance name (top left hand corner of properties box), and not a variable name. By giving Text fields an instance name we are able to treat them similar to Movie clips - and control all of their properties with Actions, instead of direct editing.
Add the rest of the components
We need to finish up by adding a combo Box, Push Button, and another text field and scrollbar for the output. This can be seen as follows:
Each Component instance name is shown in the above screen shot. For example the combo Box has an instance name of 'comboBox', the bottom scroll bar has an instance name of 'ScrollBarBottom', and the push button has an instance name of 'submit'. We now have the basic setup done - after this we use ActionScript to change the colors, properties, and actions of the components. No further editing of the FLA is needed unless you want to add some background graphics in.
| » Level Advanced |
|
Added: 2002-08-19 Rating: 7 Votes: 10 |
| » Author |
| Jeffrey Hill is a freelance web developer from Boulder, Colorado. He specializes in creating and developing dynamic database driven Flash content, applications, and content management systems. Specialty's include SQL, PHP, Perl, XML, web services, and Flash clients for web services. |
| » Download |
| Download the files used in this tutorial. |
| Download (251 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!