![MACROMEDIA FLASH 8-FLASH Скачать руководство пользователя страница 258](http://html2.mh-extra.com/html/macromedia/flash-8-flash/flash-8-flash_tutorials-manual_3348958258.webp)
258 ActionScript: Work with Objects and Classes
Modify your script
You’ll modify your script to compensate for the zero indexing.
1.
Add
+1
to the value when you create
currentMonth,
and test your
document to be sure the expected month number appears.
That line of script should read as follows:
var currentMonth:Number = myDate.getMonth()+1;
2.
Comment the trace statement:
// trace (currentMonth);
3.
Below the trace statement, set the
autoSize
property of your text box
to
true
:
currentDate_txt.autoSize = true;
4.
Use the text property of your text box to display today’s date in the form
Today is mm/dd/yyyy.
Use the
currentMonth
variable you already created, plus the
getDate()
and
getFullYear()
methods of the Date object:
currentDate_txt.text="Today is "+curre"/"+
myDate.getDate() + "/"+myDate.getFullYear();
5.
Verify that your script appears as follows:
var myDate:Date=new Date();
var currentMonth:Number = myDate.getMonth()+1;
// trace (currentMonth);
currentDate_txt.autoSize = true;
currentDate_txt.text="Today is "+curre"/"+
myDate.getDate() + "/"+myDate.getFullYear();
6.
Save and test the document.
The current date should appear in the SWF file window.
NO
TE
A finished sample file of the document you just created, named
handson1.fla, is located in your finished files folder. For the path, see
“Set
up your workspace” on page 256
.
Содержание FLASH 8-FLASH
Страница 1: ...Flash Tutorials...
Страница 10: ...10 Contents...
Страница 12: ...12 Introduction...
Страница 42: ...42 Basic Tasks Creating a banner Part 1...
Страница 78: ...78 Basic Tasks Creating a banner Part 3...
Страница 88: ...88 Basic Tasks Create Accessible Flash Content...
Страница 106: ...106 Basic Tasks Create an Application...
Страница 116: ...116 Basic Tasks Use Layout Tools...
Страница 124: ...124 Basic Tasks Create Symbols and Instances...
Страница 134: ...134 Basic Tasks Add Button Animation and Navigation...
Страница 144: ...144 Basic Tasks Create a Presentation with Screens Flash Professional Only...
Страница 192: ...192 Creating Graphics Applying Gradients...
Страница 198: ...198 Creating Graphics Apply Graphic Filters and Blends Flash Professional Only...
Страница 224: ...224 ActionScript Use Script Assist mode...
Страница 268: ...268 ActionScript Work with Objects and Classes...
Страница 270: ...270 Data Integration Overview Flash Professional Only...