2006.3頃のプログラミング


/* version 3 in 2006/1/3 */
//■個人生成
textload = new LoadVars ();
textload.load ("persontext.txt");
//必ず「&変数」にする
textload.onLoad = function () {
//onDataじゃダメ
for (i = 1; i <= textload.id; i++) {
//固有番号
var uniqueid = eval ("textload.uniqueid_" + i);
//学籍番号
var id = eval ("textload.number_" + i);
//氏名
var name = eval ("textload.name_" + i);
//かな
var kana = eval ("textload.kana_" + i);
//題名
var title = eval ("textload.title_" + i);
//概要
var summary = eval ("textload.summary_" + i);
//ゼミ
var seminar = eval ("textload.seminar_" + i);
//枚数
var sheets = eval ("textload.sheets_" + i);
user001 = new user (uniqueid, id, name, kana, title, summary, seminar, sheets);
}
luckynumber = textload.id - 1;
r = Math.floor (Math.random () * luckynumber);
display ();
};
//■配列定義
var myArray:Array = new Array ();
function user (UNI:String, id:String, NAME:String, KANA:String, TITLE:String, SUMMARY:String, SEMINAR:String, SHEETS:String) {
myArray.push ({user_unique:UNI, user_id:ID, user_name:NAME, user_kana:KANA, user_title:TITLE, user_summary:SUMMARY, user_seminar:SEMINAR, user_sheets:SHEETS});
}
//■ブーリアン生成
var key:Boolean = new Boolean (true);
function mysort (key, type:String) {
r = 0;
if (key == false) {
myArray.sortOn (type);
display ();
}
if (key == true) {
myArray.sortOn (type, Array.DESCENDING);
display ();
key = true;
} else {
none;
}
}
//■初期宣言
_root.onData = firstload ();
function firstload () {
x = 0;
r = 0;
//最初に表示されるランダムな数字を入れる
_root.fsv._visible = false;
//Sound
//click
this.createEmptyMovieClip ("sound_1_mc", this.getNextHighestDepth ());
//createEmptyMovieClip をしないと、Panなどが個別に設定できない
mySound_1 = new Sound (sound_1_mc);
mySound_1.attachSound ("sound_1");
mySound_1.setVolume (40);
//左
this.createEmptyMovieClip ("sound_1_left_mc", this.getNextHighestDepth ());
mySound_1_left = new Sound (sound_1_left_mc);
mySound_1_left.attachSound ("sound_1");
mySound_1_left.setVolume (40);
mySound_1_left.setPan (-100);
//右
this.createEmptyMovieClip ("mySound_1_right_mc", this.getNextHighestDepth ());
mySound_1_right = new Sound (mySound_1_right_mc);
mySound_1_right.attachSound ("sound_1");
mySound_1_right.setVolume (40);
mySound_1_right.setPan (100);
//hover
this.createEmptyMovieClip ("sound_4_mc", this.getNextHighestDepth ());
mySound_4 = new Sound (sound_4_mc);
mySound_4.attachSound ("sound_4");
mySound_4.setVolume (40);
mySound_4.setPan (0);
//右
this.createEmptyMovieClip ("sound_4_right_mc", this.getNextHighestDepth ());
mySound_4_right = new Sound (sound_4_right_mc);
mySound_4_right.attachSound ("sound_4");
mySound_4_right.setVolume (40);
mySound_4_right.setPan (100);
//左
this.createEmptyMovieClip ("sound_4_left_mc", this.getNextHighestDepth ());
mySound_4_left = new Sound (sound_4_left_mc);
mySound_4_left.attachSound ("sound_4");
mySound_4_left.setVolume (40);
mySound_4_left.setPan (-100);
//launch用
//var obj_mclでやるとローカルになって他で使えなくなる
//omake_s
obj_mcl_s = new MovieClipLoader ();
listener_s = new Object ();
obj_mcl_s.addListener (listener_s);
//omake_y
obj_mcl_y = new MovieClipLoader ();
listener_y = new Object ();
obj_mcl_y.addListener (listener_y);
//album
obj_mcl_album = new MovieClipLoader ();
listener_album = new Object ();
obj_mcl_album.addListener (listener_album);
//album
obj_mcl_comment = new MovieClipLoader ();
listener_comment = new Object ();
obj_mcl_comment.addListener (listener_comment);
}
//■表示用生成(テキストに表示)
function display () {
//「前」ボタンの非表示の定義
(r <= 0) ? _root.back._visible = false : _root.back._visible = true;
//「次」ボタンの非表示の定義
idpuls = textload.id - 2;
(r >= idpuls) ? _root.next._visible = false : _root.next._visible = true;
//
x = r;
_root.nowleftpage.text = r;
_root.nowrigthpage.text = (r + 1);
_root.maxpage1.text = textload.id;
_root.maxpage2.text = textload.id;
for (i = 1; i <= 2; i++) {
boxpass = eval ("_root.box" + i);
//id
text_id = eval (boxpass + ".text_id_" + i);
text_id.text = myArray[x].user_id;
//name
text_name = eval (boxpass + ".text_name_" + i);
text_name.text = myArray[x].user_name;
//title
text_title = eval (boxpass + ".text_title_" + i);
text_title.text = myArray[x].user_title;
//summary
text_summary = eval (boxpass + ".text_summary_" + i);
text_summary.text = myArray[x].user_summary;
//summary scroll
text_summary_up = eval (boxpass + ".scroll_up_" + i);
text_summary_down = eval (boxpass + ".scroll_down_" + i);
if (2 <= text_summary.maxscroll) {
text_summary_up._visible = true;
text_summary_down._visible = true;
} else {
text_summary_up._visible = false;
text_summary_down._visible = false;
}
//page
text_page = eval (boxpass + ".text_page_" + i);
text_page.text = myArray[x].user_sheets;
//seminar
text_seminar = eval (boxpass + ".text_seminar_" + i);
text_seminar.text = myArray[x].user_seminar;
//launch
launch = eval ("launch_" + i);
launch.address = myArray[x].user_id + ".pdf";
x++;
}
}
stop ();

class user {
//■変数定義
var myarraymethod:Array = new Array ();
var myarrayid:Array = new Array ();
var myarrayname:Array = new Array ();
function user (userID, userNAME) {
myarraymethod.push ("user" + userID + "_text");
//this.id = userID;
myarrayid.push (userID);
//this.name = userNAME;
myarrayname.push (userNAME);
trace (myarrayid);
}
//■並び替え
//■個人オブジェクト生成
public function personset () {
var user1 = new user (1, "yamada");
var user2 = new user (2, "hasegawa");
}
//■表示用生成
function textset () {
var i:Number;
for (i = 0; i <= 1; i++) {
var x = i + 1;
var txt = eval ("text" + x);
txt.text = "ID:" + myarrayid[i] + "\nNAME:" + myarrayname[i];
}
}
}

1行につき1コメントしてて読みやすい。
みならおうっと。