80 likes | 330 Views
Components. Prepared flash items used to give flash documents more functionality. Windows Development Panels-> Components: Some of these components are user interface components for building flash forms.
E N D
Components • Prepared flash items used to give flash documents more functionality. • Windows Development Panels-> Components: • Some of these components are user interface components for building flash forms. • Each component has a set of parameters that can be set to adjust the visual aspects of the component, how they operate, or what data they contain.
TextInput Component • The TextInput component is a single-line text component to allow user to enter data to flash file. • The TextInput component is a single-line component. • Parameters in TextInput Component: • editable indicates whether the TextInput component is editable (true) or not (false). The default value is true • password indicates whether the field is a password field (true) or not (false). The default value is false • text specifies the contents of the TextInput component. The default value is (an empty string) • visible is a Boolean that indicates whether the object is visible (true) or not (false). The default value is true
Example • Ex) this example shows how to insert a TextInput component onto the stage and manipulate it. • Create a new flash file. • Go to (Windows Development Panels-> Components) • Insert a TextInput component onto stage, and give it (myText) as instance name. • Add a button onto the stage. • On the action panel of the first frame add the following code
Example myText.visible = false; • Run the program (ctrl + Enter) • You will notice that the text input will disappear. Why?? • On the action panel of the button, add the following code: on(press) { myText.visible = true; myText.text = “Nice example”; } • Run the program
Button Component Parameters used in Button Components: • icon adds a custom icon to the button. The value is the linkage identifier of a movie clip or graphic symbol in the library; there is no default value. • This can be done by: • Inserting an image to the library (File->import to library) • Inserting new empty movie clip symbol (Insert ->new Symbol) • Dragging and dropping the image onto the symbol area. • Giving linkage identifier to the symbol (right click on symbol then choose linkage • Assign this linkage identifier to the icon parameter of the button • label sets the value of the text on the button; the default value is Button.
Button Component • selected if the toggle parameter is true, this parameter specifies whether the button is pressed (true) or released (false). The default value is false • toggle turns the button into a toggle switch. • If true the button remains in the down state when clicked and returns to the up state when clicked again. • If false the button behaves like a normal push button. • The default value is false. • visible is a Boolean value that indicates whether the object is visible (true) or not (false). The default value is true.
Button Component • Ex) this example shows how to stop a moving movie clip symbol after pressing on a toggle button component. If you pressed again, it will continue moving • Create a movie clip symbol, give it (shape) as instance name. • Add a button from the component library. Give it an instance name (btn) • Change the button to toggle button using parameter panel. • In frame (1), add the following code:
Button Component onEnterFrame = function() { if(btn.selected==false) shape._x = shape._x + 3; }