272 Lesson 7 Using Text Loading and displaying external text Information for a second property listing is saved in three additional text files in the 07Start folder.. You’ll add ActionSc
Trang 13 The font used in the selected text box appears on the left side of the dialog box
(Times New Roman Bold) In the Character ranges section, select Uppercase,
Lowercase, Numerals, and Punctuation Click OK
The character ranges that you’ve selected will be embedded in the final SWF file
Any of the characters in those ranges will display properly in your final Flash
movie
4 Select the first linked text box named description_txt
5 In the Character section of the Properties inspector, click the Embed button
The Font Embedding dialog box appears The Numerals for Character range
should already be selected since you embedded those characters for the
Mortgage Calculator
6 In the Character ranges section, select Uppercase, Lowercase, and Punctuation
in addition to Numerals Click OK
Trang 2272 Lesson 7 Using Text
Loading and displaying external text
Information for a second property listing is saved in three additional text files in the 07Start folder You’ll add ActionScript to your movie that loads information from those text files
1 Open the file in the 07Start folder called 07SampleRealEstate2-address.txt
The file contains information about the address of another property listing
2 Choose Window > Code Snippets
The Code Snippets panel appears
3 Expand the Load and Unload folder and double-click the Load External Text option
A new layer named Actions is automatically inserted in the Timeline, and the Actions panel opens to display the inserted code snippet You’ll have to customize some of the code for it to work for this particular project
Note: Make sure
you save external text
content as a text-only
file in an application
such as SimpleText
(Mac) or Notepad
(Windows) Do not
use Microsoft Word,
because Word adds
unnecessary additional
information to the file
that interferes with
its proper loading If
you use Word, always
choose Save As Text
Only.
Download from Library of Wow! ebook
Trang 34 Replace the URL in line 12 of the code snippet with the filename of the property
address, 07SampleRealEstate2-address.txt Make sure you keep the double
quotation marks surrounding the filename
The code loads the file 07SampleRealEstate2-address.txt
5 Replace the trace command in line 19 of the code snippet with the following
code that assigns the new text to the text box named address_txt:
address_txt.text = textData;
The contents of the text file, 07SampleRealEstate2-address.txt, will be displayed
in the text box named address_txt
6 In the Code Snippets panel, double-click the Load External Text option again
7 A second code snippet appears in the Actions panel that loads a second text file
Trang 4274 Lesson 7 Using Text
8 Replace the URL in line 34 with the filename of the property details, 07SampleRealEstate2-info.txt, and replace the trace command in line 41 with the following code that assigns the new text to the text box named info_txt:
info_txt.text = textData;
9 In the Code Snippets panel, double-click the Load External Text option a third time and make the code replacements to load 07SampleRealEstate2-description
txt and display the text in description_txt
The three large blocks of code snippets appear in the Actions panel one after the other
Download from Library of Wow! ebook
Trang 510 Choose Control > Test Movie > in Flash Professional
Flash loads the three external text files and displays the contents of the text files
in the targeted text boxes The listing now displays details for a property on
Cobble Hill Way instead of 7th Avenue
The photos and Mortgage Calculator still refer to the previous listing, so
the update to the new property is unfinished However, you can still see
in this incomplete example how flexible it is to develop a framework that
loads external text content and displays it in text boxes on the Stage Many
professional Flash projects rely on dynamic content fed from external assets
such as text files
Trang 6276 Lesson 7 Using Text
Review Questions
1 What is the extra SWZ file that is required for TLF Text?
2 What is the difference between Read Only, Selectable, and Editable TLF Text?
3 When do you need to embed fonts, and how do you do it?
4 How do you make text wrap around objects in a layout?
5 How do you change or read the contents of a text box?
Review Answers
1 The SWZ file is an external ActionScript library that contains information that supports
TLF Text If your Flash movie contains TLF Text, it needs the SWZ file to function
properly Flash automatically generates the additional file, which should always
accompany your SWF file
2 Read Only text is for display purposes and doesn’t allow the user to select or edit the
text Selectable text allows the user to select and copy text Editable text allows the user
to select, copy, delete, and edit the text The contents of all three kinds of text can be
changed dynamically with ActionScript
3 Fonts should be embedded for any text that may be edited or changed at runtime, which
means any Editable text box or any text box whose contents dynamically changes, except
for text that uses device fonts Choose Text > Font Embedding or click the Embed
button in the Properties inspector to display the Font Embedding dialog box In the
Font Embedding dialog box, you can choose which font, style, and range of characters to
embed in your Flash movie
4 You can wrap text around objects such as photos or graphic elements in a layout by
creating a series of linked text boxes, sometimes called threaded text containers The links
establish how overflow text from one text box flows into the next text box Create the first
text box, and then click on the small white box in its lower-right corner After the mouse
cursor changes to a text box icon, click and drag to add the next linked text box
5 A text box’s contents are determined by its text property, which accepts String values
To change or access the contents of a text box, you must first give the text box an instance
name in the Properties inspector Then, in ActionScript, you can reference the contents of
the text box with its instance name, followed by a dot, followed by the keyword text
Download from Library of Wow! ebook
Trang 7This page intentionally left blank
Trang 8278
Sound and Video
Lesson overview
In this lesson, you’ll learn how to do the following:
• Import sound files
• Edit sound files
• Use Adobe Media Encoder CS5
• Understand video and audio encoding options
• Play external video from your Flash project
• Customize options on the video playback component
• Create and use cue points
• Work with video that contains alpha channels
• Embed video in your Flash project
This lesson will take approximately three hours to complete If needed, remove the previous lesson folder from your hard drive and copy the Lesson08 folder onto it
Download from Library of Wow! ebook
Trang 9ptg
Trang 10280 Lesson 8 Working with sound and Video
getting Started
Start the lesson by viewing the finished animated zoo kiosk You’ll create the kiosk
by adding sound and video files to a project in Flash
1 Double-click the 08End.swf file in the Lesson08/08End folder to play the animation
View the movie of the polar bear with a short soundtrack of an African beat
A zoo director introduces himself, and as he speaks, Flash elements appear that are synchronized with his talk
2 Click a sound button to hear an animal sound
3 Click a thumbnail button to view a short movie about the animal Use the interface controls below the movie to pause, continue, or lower the volume
In this lesson, you’ll import audio files and put them on the Timeline to provide the short audio flourish You’ll also learn how to embed sounds in each button
You’ll use Adobe Media Encoder CS5 to compress and convert the video files to the appropriate format for Flash You’ll learn how to work with transparent back-grounds in video to create the silhouetted zoo director video You’ll also add cue points in the video of the zoo director to trigger other Flash animated elements
1 Double-click the 08Start.fla file in the Lesson08/08Start folder to open the initial project file in Flash
2 Choose File > Save As Name the file 08_workingcopy.fla, and save it in the
08Start folder Saving a working copy ensures that the original start file will be available if you want to start over
Download from Library of Wow! ebook