Download presentation
Presentation is loading. Please wait.
Published byProsper Simon Modified over 8 years ago
1
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Using Interface Fields to Receive and Display Data to the User
2
UFCFY5-30-1Multimedia Studio Agenda Types of AS3 Interface Fields Creating and Positioning Fields Assigning Values to Fields Converting Artwork to Symbols Using Functions with Interface Buttons Scripting Exercises to Implement Interface Output Using Fields.
3
UFCFY5-30-1Multimedia Studio Types of Fields in AS3 Fields are all ‘Text Fields’ Static Text Fields Input Text Fields Dynamic Text Fields.
4
UFCFY5-30-1Multimedia Studio Static Text Field The ‘Fun’ Application for Kids Press this Button Title or Message Interface Label Static text fields cannot change their information, receive input from user, store or output data.
5
UFCFY5-30-1Multimedia Studio Input Text Field User enters data into input text field Input text fields can receive data and send the data to be used in the script for processing. Data processed by script and used as required Please enter your name Bugs Bunny
6
UFCFY5-30-1Multimedia Studio Dynamic Text Field Data displayed to user Dynamic text fields output data from the program which can be changed during the process runtime as required. Data values inside script total = 23.00 Total Money Spent 23.00
7
UFCFY5-30-1Multimedia Studio All Text Fields Use String Type Text fields only use String types Numerical data must be converted accordingly Numerical input data required for a program is input via a text field and must be converted from a String type to a numerical type Numerical values to be displayed as output in a dynamic text field must be converted to a string.
8
UFCFY5-30-1Multimedia Studio Input Text Field: String Values User enters string type data Input text fields can receive string data and send the data to be used in the script for processing without conversion. Data processed by script without conversion required Please enter your name Mickey Mouse
9
UFCFY5-30-1Multimedia Studio Input Text Field: Numerical Values User enters data that must be treated as numerical data by the script Input text fields can receive receive numerical data as a String type. The data is then converted to a numerical type before being used in the script for processing Data processed by script needs to be converted to a numerical type Please enter the price 23.00 23.00 ( String) convert to 23.00 ( Number) priceOfItem = 23.00;
10
UFCFY5-30-1Multimedia Studio Dynamic Text Field: String Dynamic text fields can receive data as a String type without conversion. Data processed by script can be used directly as a String type A Message from the Computer Hello World aMesssage = “Hello World”;
11
UFCFY5-30-1Multimedia Studio Dynamic Text Field: Numeric Dynamic text fields can receive data as a numeric types after type conversion to a String. Numerical data must be converted to a String type to be displayed by the text field The Total Price 23.00 aTotalPrice = 23.00;
12
UFCFY5-30-1Multimedia Studio Creating Text Fields in Flash From the Toolbar choose the text tool Drag out a Text Box on the interface From the Text Box Properties Window choose Classic Text Select the text field required (Static, Dynamic, Input) from the drop-list If Dynamic or Static, enter an appropriate instance name in the instance name properties field.
13
UFCFY5-30-1Multimedia Studio The process of storing a value into a variable is called assignment firstNumber = 10 variable assignment operator value Creating Text Field: One Choose Classic Text Select the type of Text Filed required
14
UFCFY5-30-1Multimedia Studio Creating Text Field: Two Choose instance name
15
UFCFY5-30-1Multimedia Studio Creating Text Field: Three Choose instance name Embed Font Glyphs
16
UFCFY5-30-1Multimedia Studio Creating Text Field: Properties
17
UFCFY5-30-1Multimedia Studio Assigning Variables to Text Fields aTextField.text = aVariableName Text field instance name.text Variable name to assign
18
UFCFY5-30-1Multimedia Studio Assigning Values to Text Fields var aName:String = “Mickey Mouse”; aTextField.text = aName; // String variable aTextField.text = “Bugs Bunny”; // String literal Assigning String variables and ‘literals’:
19
UFCFY5-30-1Multimedia Studio Assigning Numeric Values var aTotalPrice:Number = 23.00; //need to convert the data from numeric to a String type aTextField.text = aTotalPrice.toString(); Assigning numerical values :
20
UFCFY5-30-1Multimedia Studio Data Type Conversion aTextField.text = aTotalPrice.toString(); toString converts the numeric type data to String type data which is required by the Text Field
21
UFCFY5-30-1Multimedia Studio Input Field Conversion numberValue = parseInt(userInputText); parsInt converts the string type data to integer type data which then be used in the calculations required by the progam
22
UFCFY5-30-1Multimedia Studio Converting Artwork to Symbols 1. Import each graphic to the library 2. Drag from library to stage 3. RMB the graphic and choose Symbol from the menu 4. Choose Button as the symbol type 5. Set / check registration point 5. Give the symbol a name 6. In the Properties Window give the symbol an instance name
23
UFCFY5-30-1Multimedia Studio Convert to Symbol
24
UFCFY5-30-1Multimedia Studio Choose Symbol Type Registration Point
25
UFCFY5-30-1Multimedia Studio Give Symbol An Instance Name
26
UFCFY5-30-1Multimedia Studio Functions and Interface Controls addButton.addEventListener(Mouse.Event.CLICK, addNumbers);
27
UFCFY5-30-1Multimedia Studio Scripting Examples & Tasks Follow the instructions in the worksheet provided to extend the tutorial two example by populating the user interface with output data. Carry out the associated extended exercise.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.