トップ 差分 一覧 Farm ソース プレゼンテーション 検索 ヘルプ PDF RSS ログイン

function


function greeting(myname:String):String {
var msg:String = "";
if (myname != null) {
msg = myname + "です。";
}
msg += "よろしくお願いします。";
return msg;
}
var theName:String="あいうえお";
var theMsg:String = greeting(theName);
var greetingMsg:String = "かきくけこ、"+theMsg;
trace(greetingMsg);



var mcs:Array = [box1, box2, box3, box4];
arrangeXY(mcs);

function arrangeXY(mclist:Array):void {
var cnt:uint = mclist.length;
var dx:int = stage.stageWidth / (cnt+1);
var dy:int = stage.stageHeight / (cnt+1);
var _mc:MovieClip;
var i:int = 0;
for (i; i<cnt; i++) {
_mc = mclist[i];
_mc.x = dx*(i+1);
_mc.y = dy*(i+1);
}
}



function sum(unit:String, ...rest):String {
var sumv:int = 0;
var cnt:uint = rest.length;
var i:int=0;
for (i; i<cnt; i++) {
sumv += rest[i];
}
return sumv + unit;
}

var msg:String = sum("杯", 2,5,7,4,6);
trace(msg);


[Flash,ActionScript3.0,function]