zoukankan      html  css  js  c++  java
  • ActionScript基本语法讲解

    var a:int = 3;
    var b:int = 4;

    b = 9;

    trace ("a的值为:"+a);
    trace ("b的值为:"+b);

    var x1:Array = new Array(1,2,3);
    var y1:Array = x1;
    y1[0] = 4;
    trace ("a现在的值为:"+x1);
    trace ("b现在的值为:"+y1);

    var q:Array = new Array("aaaaa","cccccccc","xxxxxxx");
    var s:Array = q;

    s = new Array (111,222,333);
    s[0] = 222;
    trace ("q现在的值为:"+q);
    trace ("s现在的值为:"+s);

    const foo:Array = new Array(1,2,3);
    var b1:Array = foo;
    b1[0] = 2;
    trace ("foo数组的值为:"+foo);
    trace ("b数组的值为:"+b1);

    var bx:Boolean;
    trace (bx);
    trace (bx == false);

    var d:int = 2;
    var f:int = d/3;
    trace (f);
    var g:Number = d/3;
    trace (g);

    var floatA:Number = 1.0;
    var floatB:Number = 0;

    for (var i:int = 0; i < 10; i++)
    {
    floatB = floatB + 0.1;
    }

    trace (floatB);
    trace (floatA == floatB);

    var stringSample:String = "123456";
    var stringLength = stringSample.length;
    trace (stringLength);

    var as1:Array;
    var bs1:Array = [];
    var cs1:Array = new Array();
    var ds1:Array = [1,2,3,4]
    var es1:Array = new Array(1,2,3,4,5,6);
    var fs1:Array = new Array(5);

    trace (as1);
    trace (bs1);
    trace (cs1);
    trace (ds1);
    trace (es1);
    trace (fs1);

    var obj:Object = new Object();
    obj.name = "xss";
    obj.gender = "male";
    obj.age = 9;
    obj.Hello = function(){
    trace("Hello World!!!");
    }

    trace (obj.name);
    trace (obj.gender);
    trace (obj.age);
    obj.Hello();

    var sample1:Array = [[1,2,3],[4,5,6],[7,8,9]];
    trace (sample1[2]);
    trace (sample1[2][2]);

    var sample2:Array = new Array(new Array(1,2,3),new Array(4,5,6),new Array(7,8,9));
    trace (sample2[2]);
    trace (sample2[2][2]);

    var sample3:Array = new Array(3);
    sample3[0] = [1,2,3];
    sample3[1] = [4,5,6];
    sample3[2] = [7,8,9];
    trace (sample3[2]);

    var aq:int;
    var bq:uint;
    var cq:Number;
    var dq:String;
    var eq:Boolean;
    var fq:Array;
    var gq:Object;
    var hq;
    var iq:*;

    trace (aq);
    trace (bq);
    trace (cq);
    trace (dq);
    trace (eq);
    trace (fq);
    trace (gq);
    trace (iq);

    trace (9 is Number);
    trace (9 as Number);
    trace (0.1 is Number);
    trace (0.1 as Number);

    var ax:Array = ["Q","W","E","R"];
    trace (2 in ax);
    trace (3 in ax);

    var objx:Object = new Object();
    objx.element = "xss";
    objx.tags = "csrf";
    delete objx.element;
    trace (objx.element);
    objx = null;
    trace (objx);

    var box:Array = new Array("123","456","789");
    var target:String = "789";
    for (var ss:int = 0; ss < box.length; ss++)
    {
    if (box[ss] == target)
    {
    trace ("第"+(ss+1)+"次才找到"+target);
    }
    if (ss == box.length + 1)
    {
    trace ("你要找的数据不在box数组中!!");
    }
    }

    var xss_1:Object = {key1:"xxxxx",key2:"yyyyy",key3:"zzzzz"};
    for (var k in xss_1)
    {
    trace ("键"+k+"值"+xss_1[k]);
    }

    for each (var l in xss_1)
    {
    trace ("值"+l);
    }

    输出结果:

    a的值为:3
    b的值为:9
    a现在的值为:4,2,3
    b现在的值为:4,2,3
    q现在的值为:aaaaa,cccccccc,xxxxxxx
    s现在的值为:222,222,333
    foo数组的值为:2,2,3
    b数组的值为:2,2,3
    false
    true
    0
    0.6666666666666666
    0.9999999999999999
    false
    6
    null


    1,2,3,4
    1,2,3,4,5,6
    ,,,,
    xss
    male
    9
    Hello World!!!
    7,8,9
    9
    7,8,9
    9
    7,8,9
    0
    0
    NaN
    null
    false
    null
    null
    undefined
    true
    9
    true
    0.1
    true
    true
    undefined
    null
    第3次才找到789
    键key3值zzzzz
    键key2值yyyyy
    键key1值xxxxx
    值zzzzz
    值yyyyy
    值xxxxx

  • 相关阅读:
    使用ServiceStackRedis链接Redis简介
    浅谈SQL SERVER中事务的ACID
    Sql Server查询性能优化之走出索引的误区
    Redis命令总结
    TSQL查询进阶—理解SQL Server中的锁
    SQL Server 2005 分区表实践——分区切换
    SQL Server Profiler 模板
    深入浅出SQL Server中的死锁
    不同的单元中的类可以共用同一个命名空间
    从硬盘上装xp手记(2005.8.14 )
  • 原文地址:https://www.cnblogs.com/milantgh/p/3656817.html
Copyright © 2011-2022 走看看