10月 292012
 
var a = 10;
var b = a;
a = 20;

trace(a,b);
trace("*******************************");

var c:Array = [10,20,30,40];
var d:Array;
d = c;
c[0] = 50;

trace("c:",c);
trace("d:",d);
trace("*******************************");

var e:Array = [10,20,30,40];
var f:Array;
f = e;

f[0] = 99;
trace("e:",e);
trace("f:",f);
trace("*******************************");


e = ["a","b","c"];//此时已经打破e=f

trace("e:",e);
trace("f:",f);
trace("*******************************");

e[0] = "fly";
trace("e:",e);
trace("f:",f);

trace("*******************************");
f[0] = "sky";
trace("e:",e);
trace("f:",f);
trace("*******************************");

输出:

20 10
*******************************
c: 50,20,30,40
d: 50,20,30,40
*******************************
e: 99,20,30,40
f: 99,20,30,40
*******************************
e: a,b,c
f: 99,20,30,40
*******************************
e: fly,b,c
f: 99,20,30,40
*******************************
e: fly,b,c
f: sky,20,30,40
*******************************
10月 282012
 

点击查看效果

xml_code:

<?xml version="1.0" encoding="utf-8" ?>
<root>
     <img imgUrl='/image/01.jpg' imgName="K歌" imgType ="gif" imgLink="http://baike.baidu.com/view/10114.htm"/>
     <img imgUrl='/image/02.jpg' imgName="拜拜" imgType ="gif" imgLink="http://blog.sina.com.cn/cangyue"/>
     <img imgUrl='/image/03.jpg' imgName="吃西瓜" imgType ="gif" imgLink="http://tieba.baidu.com/f?kw=%B2%D7%D4%C2&fr=ala0"/>
     <img imgUrl='/image/04.jpg' imgName="放假咯" imgType ="gif" imgLink="http://book.sina.com.cn/people/cangyue/"/>
     <img imgUrl='/image/05.jpg' imgName="加油打气" imgType ="gif" imgLink="http://baike.baidu.com/view/1584711.htm"/>
     <img imgUrl='/image/06.jpg' imgName="接力赛" imgType ="gif" imgLink="http://baike.baidu.com/view/964114.htm"/>
     <img imgUrl='/image/07.jpg' imgName="看球赛" imgType ="gif" imgLink="http://baike.baidu.com/view/884808.htm"/>
</root>

  

as_code:

Continue reading »

10月 182012
 

http://www.vini123.com/chatroom

判断两个数组相等,首先判断两个数组的长度是否相等。再判断数组里边的元素是否相等。我所想要判断的是数组长度一样,但是元素属性不一样。

看个人需要。我自己是需要第一种。

下边给出代码: 

 

 1 输出:  true false false true
 2 var arr1 = [5,6,7,8];
 3 var arr2 = [7,5,6,8];
 4 var arr3 = [7,5,6,2];
 5 var arr4 = [5,6,7,8];
 6 var aa = judgeArr(arr1,arr2);
 7 var bb = judgeArr(arr1,arr3);
 8 var cc = judgeAllArr(arr1,arr2);
 9 var dd = judgeAllArr(arr1,arr4);
10 trace(aa,bb,cc,dd);
11 
12 function judgeArr(arr1:Array,arr2:Array):Boolean
13 {
14     var len1:int = arr1.length;
15     var len2:int = arr2.length;
16     if (len1!=len2)
17     {
18         return false;
19     }
20     else
21     {
22         for (var i:int=0; i<len1; i++)
23         {
24 
25             var len = arr1.indexOf(arr2[i]);
26             if (len<0)
27             {
28                 return false;
29             }
30 
31         }
32         return true;
33     }
34 }
35 
36 //两个数组完全相等
37 function judgeAllArr(arr1:Array,arr2:Array):Boolean
38 {
39     var len1:int = arr1.length;
40     var len2:int = arr2.length;
41     if (len1!=len2)
42     {
43         return false;
44     }
45     else
46     {
47         for (var i:int=0; i<len1; i++)
48         {
49             if (arr1[i] != arr2[i])
50             {
51                 return false;
52             }
53 
54         }
55         return true;
56     }
57 }

 

 
 Posted by at 上午12:52
网站地图