240 likes | 401 Views
CIS 205—Web Design & Development. Flash Chapter 3 Working with Symbols and Interactivity. Chapter 3: Working with Symbols and Interactivity. Introduction An original drawing in Flash is called a symbol . Copies of this drawing are called instances .
E N D
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity
Chapter 3: Working with Symbols and Interactivity • Introduction • An original drawing in Flash is called a symbol. • Copies of this drawing are called instances. • The attributes of an instance can change during a movie. • There are three types of symbols: • Graphic • Button (for interactivity) • Movieclip (for placing a movie within a movie)
Lesson 1: Create Symbols and Instances • Creating a Graphic Symbol • Use the New Symbol command on the Insert menu, or • Use the Convert to Symbol command on the Modify menu • Use good naming conventions, such a g_name for a graphic symbol or b_name for a button symbol • To create an instance of a symbol, drag it from the Library panel to the stage • A symbol can be changed (color, shape, size) in the Editwindow before instances are created
Lesson 1: Create Symbols and Instances (2) • Working with Instances • An instance on the stage can be changed to a degree (rotate, skew, resize) • An instance is a single object without parts • You can use the Break Apart command for an instance, but it then loses its connection with its symbol
Lesson 1: Create Symbols and Instances (3) • Create a symbol • Start Flash, open the file fl3_1.fla where your Data Files are stored, then save the file as coolcar.fla • Verify that the Property inspector, the Library panel, and the Tools panel are displayed • Click View on the menu bar, point to Magnification, click Fit in Window • Click the Selection tool and draw a marquee around the car • Click Modify on the menu bar, click ConverttoSymbol, type g_car in the Name text box • Click the Graphic option button, click OK
Lesson 1: Create Symbols and Instances (4) • Create and edit an instance • Drag the car image from the Library panel to the stage below the first car (the new car should be selected) • Click the Selection tool, click Modify on the menu bar, point to Transform, click FlipHorizontal • Click the Color list arrow in the Property inspector (PI), click Alpha • Click the % list arrow and drag the slider to 50% • Click a blank area of the stage to deselect the object
Lesson 1: Create Symbols and Instances (5) • Edit a symbol in the edit window • Double-click the icon for the g_car symbol (just left of the name g_car) in the Library panel to display the edit window • Click the Selection tool, click the light gray hubcap inside the front wheel • Press and hold [Shift], click the hubcap inside the rear wheel to select both hubcaps • Set the Fill color to the blue gradient color swatch in the bottom row of the color palette • Click Scene 1 below the Timelinelayer to exit the symbol edit window
Lesson 1: Create Symbols and Instances (6) • Break apart an instance • Click the Selection tool, drag the marquee around the bottom car • Click Modify on the menu bar, click BreakApart • Click a blank area of the stage • Select both bluehubcaps on the bottom car • Set the Fill color to dark gray (#333333) • Double-click the g_car symbol icon in the Library window • Click the maroon front body of the car, press and hold [Shift], click the maroon rear body of the car • Set the Fill color to the red gradient, click Scene 1
Lesson 2: Work with Libraries • Understanding the Library Panel • The Library panel displays all the assets in a Flash movie • Title tab: The list box below the title tab can be used to display the Library panel for a certain document • Options menu (upper-right corner of the panel): Contains several features for editing symbols • Item Preview window: Displays a selected item • Toggle Sorting Order icon (right of Type): For sorting items • Wide Library View and Narrow Library View icons (below the Toggle Sorting Order icon): For wide and narrow views • Name text box: Lists all the folder and symbol names • New Symbol icon (lower-left corner): To create a new symbol • New Folder icon (bottom of panel) • Properties icon (bottom of panel): Displays the Symbol Properties dialog box • Delete Item icon: Deletes the symbol or folder
Lesson 2: Work with Libraries (2) • Create folders in the Library panel • Open the file fl3_2.fla where your Data Files are stored, then save the file as carRace.fla • Verify that the Property inspector, the Library panel, and the Tools panel are displayed • Click View on the menu bar, point to Magnification, click Fit in Window • Click each item in the Library panel to display it • Click the New Folder icon, type Graphics in the Name text box, press [Enter] • Click the New Folder icon, type Buttons in the Nametext box, press [Enter]
Lesson 2: Work with Libraries (3) • Organize symbols within Library panel folders • Click the Toggle Sorting Order icon • Drag the g_title symbol in the Library panel to the Graphics folder • Drag the other graphic symbols to this folder • Drag the b_reset symbol to the Buttons folder • Double-click the Graphics folder to open it • Double-click the Graphics folder to close it
Lesson 2: Work with Libraries (4) • Display the properties of symbols, rename symbols, and delete a symbol • Double-click the Graphics folder to open it • Click the g_car1 symbol, click the Properties icon (bottom of Library panel) • Type g_redCar in the Name text box, click OK • Rename g_car2 to g_blueCar • Click the g_border icon, click the Delete icon (trash can) at the bottom of the Library panel
Lesson 2: Work with Libraries (5) • Use multiple Library panels • Click the Library panel list arrow (near the top) • Click coolcar.fla, then click g_car • Click Frame 1 on the Resetlayer, drag the car from the Library panel to the center of the stage • Click the Library panel list arrow, click carRace.fla • Click the g_car symbol in the Library panel • Click the Deleteicon at the bottom of the Library panel • Save your work • Close the coolcar.fla tab
Lesson 3: Create Buttons • Understanding Buttons • Buttons have four states that determine appearance: • Up—when the mouse pointer is not over it • Over—when the mouse pointer is over it • Down—after a mouse click • Hit—defines the area that responds to a click • When you create a button symbol, Flash creates a Timeline with four frames for the four states • Process for buttons: • Create a button symbol • Edit the button symbol • Return to the Timeline • Preview the button
Lesson 3: Create Buttons (2) • Create a button • Insert a layer above the reset layer and name it signal • Select the Rectangle Primitive tool, click the Stroke color tool, click the No Stroke icon in the upper-right of the color palette • Set the Fill color to the red gradient color swatch • Click the Reset button in the Property inspector • Draw the rectangle as shown in Fig. 21 (p. 3-18) • Click the Zoom tool, then click the rectangle • Select the rectangle, click Modify on the menu bar, click Convert to Symbol • Name the button b_signal, click the Button option button, click OK • Drag the b_signal symbol to the Buttons folder
Lesson 3: Create Buttons (3) • Edit a button and specify a Hit area • Open the Buttons folder in the Library panel, right-click b_signal, click Edit • On Layer 1, click Over, then click Insert on the menu bar, point to Timeline, click Keyframe • Set the Fill color to the gray gradient color swatch • Insert a keyframe in the Down frame on Layer 1 • Set the Fill color to the green gradient color swatch • Insert a keyframe in the Hit frame on Layer 1 • Set the Fill color to the blue gradient color swatch • Click Scene 1 below the Timeline
Lesson 3: Create Buttons (4) • Test a button • Click the Selection tool, click a blank area of the stage • Click Control on the menu bar, then click EnableSimple Buttons • Point to the signal button on the stage (it should turn gray) • Click and hold the button (it should turn green) • Click Control on the menu bar, click Enable Simple Buttons to turn off the command • Click Window on the menu bar, click Library • Click the View box list arrow (below and on the right side of the Timeline) , click Fit in Window, save the file
Lesson 4: Assign Actions to Frames and Buttons • Understanding Actions • A Flash movie plays all layers simultaneously, frame by frame • A user can perform an action, such as starting or stopping a movie, or jumping to a particular frame • An action can be applied to the Down state of a button (mouse click) • The Flash language called ActionScript allows you to add actions to buttons and frames
Lesson 4: Assign Actions to Frames and Buttons (2) • Analyzing ActionScript • ActionScript is a powerful scripting language • Example: on (release) { gotoAndPlay(10); } • In the above example, release means ‘mouse click’ and gotoAndPlay(10) means go to frame 10 and play the movie • You don’t have to learn ActionScript to use it—the Script Assist feature allows you to assign basic actions • ActionScript 2.0 and 3.0: AS3 is very complex, but AS2 is compatible with Script Assist
Lesson 4: Assign Actions to Frames and Buttons (3) • Assign a stop action to frames • Click Control on the menu bar, click TestMovie, close the movie window • Insert a new layer, name it stopmovie, click Frame 1 • Click Window on the menu bar, click Actions • Verify the Script Assist button (far right) is off (not outlined), click the List arrow for the ActionScript options, point to ActionScript 1.0 & 2.0, click • Verify stopmovie:Frame1 is displayed in the lower left corner of the Actions panel • Click the Add a new item button (plus sign) in the Actions panel, point to Global Functions, point to Timeline Control, click stop • Insert a keyframe in Frame 66 on the stopmovie layer, then repeat Step 6 and test the movie (it will not play due to the stop action at Frame 1), close the movie
Lesson 4: Assign Actions to Frames and Buttons (4) • Assign a goto action to a button • Click Frame 1 of the signal layer • Move the Actions panel to view the signal button • Click the Selection tool, click the button on the stage • Verify that the b_signal button is displayed in the lower left of the Actions panel • Click the Script Assist button (far right on the Actions panel) to turn on this feature • Click the Add a new item button (plus sign), point to GlobalFunctions, point to Movie Clip Control, click on • Click the Add a new item button, point to Timeline Control, click goto • Change the Frame number to 2 in the Frame text box • Click Control on the menu bar, click Test Movie • Click the signal button to play, close the movie
Lesson 4: Assign Actions to Frames and Buttons (5) • Assign a goto frame action to a button • Click Frame 66 of the reset layer to display the Reset button on the stage • Click the Reset button to select it • Verify that b_reset is displayed in the lower left of the Actions panel • Verify that Script Assist is active • Click Add a new item button, point to Global Functions, point to Timeline Control, click goto, verify that Frame 1 is specified • Click Control on the menu bar, click Test Movie • Click the signal button to start the movie • When the movie stops click the Reset button
Lesson 4: Assign Actions to Frames and Buttons (5) • Assign a goto frame action to a button • Click Frame 66 of the reset layer to display the Reset button on the stage • Click the Reset button to select it • Verify that b_reset is displayed in the lower left of the Actions panel • Verify that Script Assist is active • Click Add a new item button, point to Global Functions, point to Timeline Control, click goto, verify that Frame 1 is specified • Click Control on the menu bar, click Test Movie • Click the signal button to start the movie • When the movie stops click the Reset button
Lesson 4: Assign Actions to Frames and Buttons (6) • Assign a second event to a button • Click the right curly bracket ( } ) in the Actions panel in Step 3 of the ActionScript • Click the + in the Script Assist window, point to GlobalFunctions, point to Movie Clip Control, click on • Deselect the Release check box, click the Key Press check box and then press the [Home] key on the keyboard • Click the +, point to Global Functions, point to TimelineControl, click goto (the Home key now acts like the Reset button) • Click File on the menu bar, point to PublishPreview, click Default—(HTML); the movie opens in a browser • Click the signalbutton to start the movie, [Home] to reset