`
kree
  • 浏览: 127256 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

flex中 for in 与 for each in 的区别。

    博客分类:
  • Flex
阅读更多

 

package 
{ 
	import flash.display.Sprite;
	
	public class firstActionScript extends Sprite 
	{ 
		//flex工作原理  浏览器嵌入的flash player 运行flex生产的html  html运行生产的swf
		// * 任意的数据类型
		public function firstActionScript()
		{
			var array:Array = ["a","b","c","d"];
			for(var str:String in array) {
				trace("str"+str); //拿到的是索引  0 1 2 3
				trace(array[str]);//拿到的值 a b c d
			}
			for each(var str1:String in array) {
				trace("str"+str1);//直接拿值 a b c d
				
			}
			trace("------------------------------");
			var obj:Object = {id:3,name:"zhangsan",age:18};
			trace(obj.id);
			trace("--------------");
			for (var st:String in obj) {
				trace(st);//拿到属性 id name age
			}
			for each(var st1:String in obj) {
				trace(st1);//拿到属性对应的值 3  zhangsan  18
			}
			
			trace("--------------");
			trace(obj.name); //结果zhangsan
			trace(obj["name"]);//结果zhangsan
		} 
	} 
}
 

 

分享到:
评论

相关推荐

    Flex Solutions Essential Techniques For Flex 2 And 3

    In each solution, Marco takes you through the workings of the example step by step, and then presents some expert's tips, which will take your understanding further, and give you unique insights into ...

    flex DataGrid 导出Xls

    flex DataGrid 导出Xls ... for each(var field:String in fields){ for each (var value:String in record){ if (record[field].toString() == value) sheet.setCell(row,i,value); } i++; } } }

    Lexical Analysis with Flex

    Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text. The flex program reads user-specified input files, or its ...

    Getting Started with Flex 4

    Ideal for experienced developers with or without a background in Flex, Getting Started with Flex 4 shows you how to take advantage of your existing skills. You'll quickly discover how easy RIA ...

    Foundation Flex For Developers - Data-Driven Applications With Php, Asp.Net, Coldfusion

    It was also interrupted by the birth of my son in June 2007, so it’s been a long road. I hope you enjoy reading this book and that you find it useful for demonstrating some of the ...

    Hello! Flex 4

    Flex also provides powerful data handling for industrial-strength applications. We think it should be just as much fun to learn Flex as it is to use it. And we know that fun learning gets better ...

    Flex 编程技巧

    3. for each ( var i:Object in ac ){ 4. bar.addItem( i ); 5. } 6. // fantastic ! // 7. var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list ); 3. 打开 URL 1. navigateToURL...

    The Essential Guide to Flex 3 (Part 1)

    While I have a case study in the book, each chapter will stand on its own, without reliance on exercises done in previous chapters. For that reason, you can open to nearly any chapter and just ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - ADD: In TFlexPanel.DefaultLinkPoint property added Size field that lets define visual size of the connection points of the flex-connectors. Initialized with DefaultLinkPointSize constant in the ...

    五子棋游戏(Flex 源码)

    Package application.view.components.* contains classes for each symbol in library. There is no need in most of them unless you're using FlexBuilder to write code. I've added them so that FB3 whouldn't...

    AdvancED ActionScript 3.0: Design Patterns

    AdvancED ActionScript 3.0 is for Flash and/or Flex developers seeking a better understanding of object-oriented programming and the knowledge to utilize it in a manner practical to the language itself...

    UltraFLEX_9.10.00.zip

    • Views by Instrument: The documentation that is available for each instrument. • Views by Device: For device types that are commonly tested with the UltraFLEX test system, the Test Technique ...

    GNULinuxApplicationProgramming

    While the book was written with an implicit order in mind, each chapter can be read in isolation, depending upon your needs. Where applicable, references to other chapters are provided if more ...

    RxLib控件包内含RxGIF,全部源码及DEMO

    (RTF) data in a memo or BLOB field (only for Delphi 2.0 or higher). TAnimatedImage - animation "bitmap by bitmap". Design-time editor allows you to load Windows animation cursors (ani-files) into ...

    VB编程资源大全(英文源码 控件)

    It is a must for the bussiness softwares <END><br>61,Shcmb201.zip ShComboBox shows folders and files in the Shell's Namespace in a cascaded order, exactly like the ComboBox in Windows Explorer....

    Spring Recipes A Problem-Solution Approach [英文原版]

    Each release since marks the introduction of new features designed to both simplify and enable solutions. With version 2.0 and later, the Spring framework started targeting multiple platforms. The ...

    Printed Circuits Handbook

    14.5 Interfacing Cae, Cad, and CAMTools to Each Other / 14.11 14.6 Inputs to the Design Process / 14.11 Chapter 15. Electrical and Mechanical Design Parameters 15.1 15.1 Printed Circuit Design ...

    Flash Sample

    The source files for these movies can be found in the Flash MX/Samples folder. Notice You may reuse these files as you want, but they are not officially supported as part of the product....

Global site tag (gtag.js) - Google Analytics