飛び飛びに値を入れた配列の長さは?
先輩の質問への回答用
* 飛び飛びに宣言したときは、それまでの配列も確保されます。
* のでarray.lengthは5になりません。
♥0 |
Line 38 |
Modified 2009-09-19 18:43:17 |
MIT License
archived:2017-03-20 05:01:25
ActionScript3 source code
/**
* Copyright esukei ( http://wonderfl.net/user/esukei )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/q3qF
*/
/**
* 先輩の質問への回答用
* 飛び飛びに宣言したときは、それまでの配列も確保されます。
* のでarray.lengthは5になりません。
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.Point;
[SWF(frameRate = "8")]
public class FlashTest extends Sprite {
private var textField:TextField;
public function FlashTest() {
// write as3 code here..
textField = new TextField();
textField.width = stage.stageWidth;
textField.height = stage.stageHeight;
textField.multiline = true;
textField.wordWrap = true;
textField.text = 'LOGGING HERE.';
addChild(textField);
var array:Array = new Array();
array[1] = 1;
array[10] = 10;
array[100] = 100;
array[1000] = 1000;
array[10000] = 10000;
clearLog();
addLog('配列の長さ:' + array.length.toString());
addLog('配列の中身:');
addLog(array.toString());
}
private function addLog(log:String):void
{
textField.appendText(log + '\n');
}
private function clearLog():void
{
textField.text = '';
}
}
}