freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計算機科學與技術(shù)外文翻譯-其他專業(yè)(編輯修改稿)

2025-02-24 02:18 本頁面
 

【文章內(nèi)容簡介】 = null。 You can use a variable in any situation in which you could use the value the variable contains. You‘ve already seen an example of this with the trace() actions. You can use a variable to tell Flash what message to output: var sMessage:String = “ Wele!” 。 trace(sMessage)。 You can also perform other kinds of operations using variables, just as you would on the actual values themselves. For example: var nQuantity:Number = 6。 var nPrice:Number = 。 trace(nQuantity * nPrice)。 // Displays: Naming Variables Now that you‘ve looked at declaring and defining variables, the next thing to examine is how to name the variables. There are two main parts to this discussion. First, there is the matter of using valid variable names that Flash will understand, so we‘ll look at the rules for naming variables. Second, we‘ll examine some additional guidelines for naming variables that, while not strictly enforced by Flash, will aid you in creating more readable code. The following are the rules that you must follow for Flash to be able to understand your variable names: ? The first character must be an underscore (_), a dollar sign ($), or a letter. The first character cannot be a number. Although underscores and dollar signs are allowable as the first character, in practical application, you will almost always start the variable name with a letter. ? The subsequent characters must be underscores (_), dollar signs ($), letters, or numbers. ? Variable names can have no spaces. ? The name cannot be a keyword or other special value recognized by Flash. For example, the names MovieClip, true, String, and undefined are not allowable variable names because they already have other meanings in ActionScript. ? The name must be unique (within its scope). If you create two variables with the same name in the same scope (more on scope in Chapters 4 and 5), the latter will overwrite the former. Next, let‘s talk about some good naming conventions that you can use. First, because you‘ll want to be using strong typing with all your variables, it is a good idea to have a 畢業(yè)設(shè)計(論文) 外文資料 原文 7 convenient way to be reminded of what type of value a variable can hold. A system named Hungarian notation has been devised that can assist in this. For our purposes, we‘ll use a modification of Hungarian notation specifically designed for ActionScript. With this system, you can prefix each variable name with a character (or, in some cases, several characters) that can help you to remember what type of datatype the variable can hold. You may have already seen this in the previous examples in this chapter. When we define a variable named nQuantity, the variable name is prefixed with the character n. This tells us that the variable holds a number value. Table 31 shows a list of other remended prefixes. Table 31: Modified Hungarian Notation ActionScript Prefixes for Common Classes Prefix Datatype a Arra y bmp BitmapData b Boolean bt Button c Color cam Camera cm ContextMenu cmi ContextMenuItem d Date lc LocalConnection lv LoadVars m MovieClip mcl MovieClipLoader mic Microphone n Number nc NetConnection ns NetStream o Object pj PrintJob rs RecordSet s String snd Sound so SharedObject t TextField tf TextFormat 畢業(yè)設(shè)計(論文) 外文資料 原文 8 vid Video xml XML xmls XMLSocket This modified Hungarian notation convention is pletely optional, but it can be very useful. It helps not only you, but also others who may read your code. By adding the appropriate prefix to the variable name, it makes it immediately clear what type of datatype the variable can hold. It‘s also important when naming your variables to make the names as descriptive as possible. For example, the variable name nQuantity is much more descriptive than nQ. Of course, the level of descriptiveness required depends on the context. For example, if your Flash application deals with quantities of widgets as well as cogs, nQuantity might not be sufficiently clear. It would be better, in such a case, to have variables named nQuantityCog and nQuantityWidget, for example. The more descriptive the variable name, the better, in most situations. Just remember, though, that most likely you‘ll be typing the same variable name multiple times, so it is important to achieve the correct balance between descriptiveness and name length. You can always use abbreviations in the variable names if appropriate. For example, rather than defining a variable named nQuantityWidget you might find it easier to define a variable named nQntyWidget. Remember that you cannot use spaces in your variable names. However, when you want to make your variable names descriptive, the names will often consist of more than one word. There are two conventions that are monly used when naming variables with multiple words. The first of the two conventions is to use the underscore (_) to separate your words in the variable name. An example of this method follows: var sFirst_name:String = “ Joey” 。 The second of these conventions is what is known as the interCap method (also known as studlyCaps or camelCaps). The word ―interCap‖ refers to the capitalization of the first letter of each word subsequent to the first, using no spaces or underscores—internal capitalization. An example of this method is the following: var sFirstName:String = “ Joey” 。 It would behoove you to use one of these conventions. Pick one that you like, and if you decide you prefer the other one later on, switch to it. In this book we tend to prefer the interCap method, so you see a preference for it in the examples. But neither convention is more correct or offers any advantages over the other one. It is also important to remember that ActionScript is casesensitive. This means that sFirstName, sFirstname, SfirstName, and so on are all diff
點擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1