as 幫助文件筆記 二

2021-04-17 12:04:00 字數 2760 閱讀 2022

四 處理日期和時間

1 常見的日期和時間資訊處理任務:

2 建立date 物件

a    

var now:date = new date();   結果

b  

var millisecondsperday:int = 1000 * 60 * 60 * 24;

// 獲取乙個表示自起始日期 1970 年 1 月 1 日後又過了一天時間的 date 物件

var starttime:date = new date(millisecondsperday);

結果:fri jan 2 08:00:00 gmt+0800 1970 

c  var millenium:date = new date(2000, 0, 1, 0, 0, 0, 0);    0代表一月

結果 :sat jan 1 00:00:00 gmt+0800 2000    

d     var nextday:date = new date("mon may 1 2006 11:30:00 am");

結果 : mon may 1 11:30:00 gmt+0800 2006  

3 得到具體的時間日期date下面有相應的屬性和方法

var getdate:date  = new  date();

var getmonth = getdate.month()+1;   得到的月的範圍是0-11,所以要加一    getmonth();  date getdate();

結果 : 4   settime();得到時間

4 如果應用程式將執行大量的日期和時間運算,您可能會發現建立常量來儲存常見時間單位值(以毫秒的形式)   非常有用,如下所示:

public static const millisecondsperminute:int = 1000 * 60;

public static const millisecondsperhour:int = 1000 * 60 * 60;

public static const millisecondsperday:int = 1000 * 60 * 60 * 24;

使用 adobe flash cs3 professional 開發應用程式時,您可以訪問時間軸,這會使您穩定且逐幀地完成該應       用程式。但在純 actionscript 專案中,您必須依靠其它計時機制。

要啟動計時器,請先建立 timer 類的例項,並告訴它每隔多長時間生成一次計時器事件以及在停止前生成多少   次事件。例如,下列**建立乙個每秒排程乙個事件且持續 60 秒的 timer 例項:

var oneminutetimer:timer = new timer(1000, 60);//一秒鐘執行一次,一共執行60次

7 timer 物件在每次達到指定的間隔時都會排程 timerevent 物件。timerevent 物件的事件型別是timer(由常    量timerevent.timer定義)。

如果將 timer 例項設定為固定的間隔數,則在達到最後一次間隔時,它還會排程timercomplete事件(由常量timerevent.timer_complete定義)。

例子在手冊中的控制時間間隔部分

8  建立圓的border所用的組合方法

graphics.linestyle(0.5, 0x999999);

graphics.beginfill(0xeeeeff);

graphics.drawcircle(100, 100, 100);

graphics.endfill();

五   處理字串

1 字串的定義

var str1:string = "helloo";

var str2:string = new sting("hello");

2 length屬性

字串和 null 字串的長度均為 0,

3 處理字串中的字元  var str1:string = "yello";  trace(str1.charat(1));  輸出的是e

4 在使用+連線運算子連線 string 物件和不屬於字串的物件時,無需使用tostring()方法。

var str1:string = "bonjour";

var str2:string = "from";

var str3:string = "paris";

var str4:string = str1.concat(" ", str2, " ", str3);

// str4 == "bonjour from paris"

6 查詢字串  substr()   substring()   slice()    indexof()  lastindexof()  split()

search()

var pattern:regexp = /the/i;

var str:string = "the more the merrier.";

trace(str.search(pattern)); // 0   正則中的i是不區分大小寫的概念

match()      replace()

7 大小寫轉換  tolowercase()   touppercase()

六 處理陣列,七處理錯誤,八使用正規表示式    都沒有看

Git幫助文件閱讀筆記 第二章

工作目錄下面的所有檔案都不外乎這兩種狀態 已跟蹤或未跟蹤 檔案的狀態變化週期 git status 如果當前工作目錄中新增了新檔案,會顯示為未跟蹤狀態 vim readme git status on branch master untracked files use git add to incl...

ntfsclone 幫助文件

description ntfsclone將有效地轉殖 複製,儲存,備份還原 或拯救乙個ntfs檔案為稀疏檔案 影象 裝置 間隔 或標準輸出.它 工作於磁 盤扇區級的副本,且拷貝用資料.剩餘的磁碟空間變得為零 轉殖稀疏檔案 編碼與控制碼 儲蓄特殊影象格式 剩餘的不變 轉殖到磁碟 分割槽 或充滿零點 ...

MyLibrary幫助文件

xml的用法.astuetz pagerslidingtabstrip pagerslidingtabstripextends android id id main tabs android layout width match parent android layout height 48dp 底...