Solved

Refinment of code

Posted on 2008-06-15
39
427 Views
Last Modified: 2013-11-11
I have been working with people on here to refine and compact code for a form... and I know it has a long way to go... but I thought that Id come back to the global view of it and see if any one can suggest a tighter way to write it... It all works which is great and so I just need to figure out how to save download space client resources and stuff like that...


it runs at 186kb down load right now... I'd like to get a lower... and making the functions lean... thanks for the help...

////////Motion
 

import mx.transitions.Tween;

import mx.transitions.easing.*;

function fallin():Void {

	var myHoriTween:Tween = new Tween(Symbol, "_x", Back.easeInOut, -450, 10, 1.5, true);

}

function fallaway():Void {

	var xPositionT:Tween = new Tween(Symbol, "_x", Strong.easeOut, -50, 600, 2, true);

}
 
 

////XML dtat handling

Jobs_xmlc.trigger();

function sendHandler(ev:Object):Void {

	trace("Got Send Event at "+getTimer());

	//causes a movieclip named ball fade to an alpha of 40

}

function resultHandler(ev:Object):Void {

	trace("Got Result Event at "+getTimer());

	fallin();

	LoadingMC._x = 2000;

}

function statusHandler(ev:Object):Void {

	var statCode:String = ev.code;

	if (statCode == "StatusChange") {

		//Iignore StatusChange type events

	} else {

		trace("Got Status Event at "+getTimer()+" : Code is"+statCode);

		//fallin();

		trace("FaultCode: "+ev.data.faultcode);

		trace("FaultString: "+ev.data.faultstring);

	}

}

Jobs_xmlc.addEventListener("send", sendHandler);

Jobs_xmlc.addEventListener("result", resultHandler);

Jobs_xmlc.addEventListener("status", statusHandler);

//////TransFX
 
 
 
 
 

//////////////Employer datagrid

emps_xmlc.addEventListener("send", sendHandler);

emps_xmlc.addEventListener("result", resultHandler);

emps_xmlc.addEventListener("status", statusHandler);
 

///edit em

PG_8.addEmplyor.CloseX._width = 0;

emps_xmlc.trigger();

import mx.data.components.datasetclasses.DataSetIterator;

var intID:Number = setInterval(checkChanges, 100);

function checkChanges():Void {

	PG_8.addEmplyor.changesPending_ch.selected = emps_ds.changesPending();

}

PG_8.addEmplyor.CloseX.onRelease = function() {

	PG_8.addEmplyor.CloseX._width = 0;

	focusManager.setFocus(PG_8.emps_grd);

	PG_8.new_btn._x = 324.8;

	PG_8.delete_btn._x = 426.3;

	PG_8.addEmplyor.edit_btn._width = 100;

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 360, 351, 2, true);

};

PG_8.addEmplyor.new_btn.addEventListener("click", tabOpen);

PG_8.new_btn.onRelease = function() {

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 350, 117, 2, true);

	focusManager.setFocus(PG_8.emps_grd);

	PG_8.addEmplyor.CloseX._width = 24.1;

	PG_8.addEmplyor.edit_btn._width = 0;

	PG_8.new_btn._x = 2000;

	PG_8.delete_btn._x = 2000;

	

	emps_ds.addItem({Employer:"new Employee", dept:" ", sex:" "});

};

PG_8.addEmplyor.edit_btn.onRelease = function() {

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 350, 117, 2, true);

	PG_8.addEmplyor.CloseX._width = 24.1;

	PG_8.addEmplyor.edit_btn._width = 0;

	PG_8.new_btn._x = 2000;

	PG_8.delete_btn._x = 2000;

	focusManager.setFocus(PG_8.emps_grd);

	

};

PG_8.delete_btn.onRelease = function() {

	emps_ds.removeItem();

};

PG_8.addEmplyor.save_btn.onRelease = function() {

	emps_ds.applyUpdates();

};

function dsLoaded(ev:Object):Void {

	emps_ds.addSort("nameAscending", ["Employer"]);

	emps_ds.addSort("nameDescending", ["Employer"], DataSetIterator.Descending);

}

emps_ds.addEventListener("afterLoaded", dsLoaded);

function dsPtrChange(ev:Object):Void {

	PG_8.sexRG.selectedData = ev.target.sex;

}

function newSex(ev:Object):Void {

	emps_ds.sex = ev.target.selectedData;

}

emps_ds.addEventListener("iteratorScrolled", dsPtrChange);

PG_8.sexRG.addEventListener("click", newSex);

PG_8.addEmplyor.ascending_btn.onRelease = function() {

	emps_ds.useSort("nameAscending");

};

PG_8.addEmplyor.descending_btn.onRelease = function() {

	emps_ds.useSort("nameDescending", "dept");

};

PG_8.male_btn.onRelease = function() {

	emps_ds.filterFunc = males;

	emps_ds.filtered = true;

};

function males(item:Object):Boolean {

	return item.sex == "M";

}

PG_8.female_btn.onRelease = function() {

	emps_ds.filterFunc = females;

	emps_ds.filtered = true;

};

function females(item:Object):Boolean {

	return item.sex == "F";

}

PG_8.all_btn.onRelease = function() {

	emps_ds.filtered = false;

};

// Alter DataGrid dimensions.

PG_8.emps_grd.columnNames = ["Employer", "Address", "Phone", "Supervisor", "Contact", "Wage", "Duties", "From", "To", "Reason"];

PG_8.emps_grd.getColumnAt(0).width = 90;

PG_8.emps_grd.getColumnAt(1).width = 100;

PG_8.emps_grd.getColumnAt(2).width = 70;

PG_8.emps_grd.getColumnAt(3).width = 100;

PG_8.emps_grd.getColumnAt(4).width = 50;

PG_8.emps_grd.getColumnAt(5).width = 60;

PG_8.emps_grd.getColumnAt(6).width = 120;

PG_8.emps_grd.getColumnAt(7).width = 50;

PG_8.emps_grd.getColumnAt(8).width = 50;

PG_8.emps_grd.getColumnAt(9).width = 120;

PG_8.emps_grd.hScrollPolicy = "on";

PG_8.emps_grd.headerHeight = 30;

PG_8.emps_grd.rowHeight = 60;

PG_8.emps_grd.vScrollPolicy = "auto";

//PG_8.emps_grd.wordWrap="true";

//PG_8.emps_grd.multiline="true";

//import mx.transitions.easing.*;

//_global.styles.ScrollSelectList.setStyle("selectionEasing", Elastic.easeInOut);

//_global.styles.ScrollSelectList.setStyle("selectionDuration", 350);

//_global.styles.ScrollSelectList.setStyle("wordWrap", true);

//_global.styles.ScrollSelectList.setStyle("multiline", true);

_global.styles.ScrollSelectList.setStyle("alternatingRowColors", [0xE9DDBA, 0xffffff]);

_global.styles.ScrollSelectList.setStyle("fontSize", 12);

_global.styles.ScrollSelectList.setStyle("backgroundColor", 0xE9DDBA);

_global.styles.ScrollSelectList.setStyle("rollOverColor", 0xa48e65);

_global.styles.ScrollSelectList.setStyle("selectionColor", 0xffde9d);

_global.styles.ScrollSelectList.setStyle("fontFamily", "Arial");

_global.styles.ScrollSelectList.setStyle("fontWeight", "bold");

_global.styles.ScrollSelectList.setStyle("color", 0x972c25);

_global.styles.ScrollSelectList.setStyle("textRollOverColor", 0x972c25);

_global.styles.ScrollSelectList.setStyle("textSelectedColor", 0x000000);

PG_8.emps_grd.dataProvider = emps_xmlc;

PG_8.emps_grd.iconFunction = function(item) {

	trace(item.data);

	if (item.data == "Employer") {

		return "Employer";

	} else {

		return "fail";

	}

};

trace(emps_xmlc[item.index]);

var listListener:Object = new Object();

listListener.itemRollOver = function(item) {

	time1 = getTimer();

	onEnterFrame = function () {

		if (getTimer()-time1>500) {

			//Build the Word Balloon Text Field

			_root.createEmptyMovieClip("wordBalloon", 1);

			_root.wordBalloon._x = _xmouse-27;

			_root.wordBalloon._y = _ymouse-bTxtH-30;

			_root.wordBalloon.wordBalloonShadow._x = 2;

			_root.wordBalloon.wordBalloonShadow._y = 2;

			_root.wordBalloon.createEmptyMovieClip("wordBalloonGraphic", 10);

			_root.wordBalloon.createEmptyMovieClip("wordBalloonShadow", 5);

			_root.wordBalloon.wordBalloonGraphic.createTextField("balloon_txt", 1, 10, 10, 50, 50);

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.selectable = false;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.html = true;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.autoSize = true;

			//Text Format

			balloonFormat = new TextFormat();

			balloonFormat.font = "Arial";

			balloonFormat.size = 16;

			balloonFormat.color = 0x000000;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.htmlText = "Employer"+item.index+" :"+item.label;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.setTextFormat(balloonFormat);

			//The Width and Height of the Dynamic Textfield

			bTxtW = _root.wordBalloon.wordBalloonGraphic.balloon_txt._width;

			bTxtH = _root.wordBalloon.wordBalloonGraphic.balloon_txt._height;

			//Build Balloon

			with (_root.wordBalloon.wordBalloonShadow) {

				lineStyle(4, 0x000000, 30);

				moveTo(bTxtW, 0);

				curveTo(bTxtW+20, 0, bTxtW+20, 20);

				lineTo(bTxtW+20, bTxtH);

				curveTo(bTxtW+20, bTxtH+20, bTxtW, bTxtH+20);

				lineTo(30, bTxtH+20);

				lineTo(25, bTxtH+30);

				lineTo(20, bTxtH+20);

				lineTo(20, bTxtH+20);

				curveTo(0, bTxtH+20, 0, bTxtH);

			}

			with (_root.wordBalloon.wordBalloonGraphic) {

				beginFill(0xFFFFCC, 100);

				lineStyle(4, 0x000000, 100);

				moveTo(20, 0);

				lineTo(bTxtW, 0);

				curveTo(bTxtW+20, 0, bTxtW+20, 20);

				lineTo(bTxtW+20, bTxtH);

				curveTo(bTxtW+20, bTxtH+20, bTxtW, bTxtH+20);

				lineTo(30, bTxtH+20);

				lineTo(25, bTxtH+30);

				lineTo(20, bTxtH+20);

				lineTo(20, bTxtH+20);

				curveTo(0, bTxtH+20, 0, bTxtH);

				lineTo(0, 20);

				curveTo(0, 0, 20, 0);

				endFill();

			}

			_root.wordBalloon._visible = true;

		}

	};

};

listListener.itemRollOut = function(item) {

	delete onEnterFrame;

	_root.wordBalloon._visible = false;

};

PG_8.emps_grd.addEventListener("itemRollOver", listListener);

PG_8.emps_grd.addEventListener("itemRollOut", listListener);

////////////////////Context menu

//var my_cm:ContextMenu = new ContextMenu();

//var menuItem_cmi:ContextMenuItem = new ContextMenuItem("Send e-mail", emailHandler);

//my_cm.customItems.push(menuItem_cmi);

//email_mc.menu = my_cm;

//function emailHandler() {

//	trace("sending email");

//}

///ssnop out
 

///Learn about job

PG_2.learnabout_job_othertxt._x = 2000;

function onSelectLearnAbout_Other(checkbox) {

	if (PG_2.learnabout_job_other.selected == true) {

		PG_2.learnabout_job_othertxt.text = "";

		PG_2.learnabout_job_othertxt._x = 277.2;

	} else {

		PG_2.learnabout_job_othertxt._x = 2000;

		PG_2.learnabout_job_othertxt.text = "";

	}

}

PG_2.learnabout_job_other.addEventListener("click", onSelectLearnAbout_Other);
 
 
 

var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"},

						    {mc:PG_1.urstate, type:"comboBox"},

						    {mc:PG_1.primphonetype, type:"comboBox"},

						    {mc:PG_1.altphonetype, type:"comboBox"},

						    {mc:PG_2.emerg_contype, type:"comboBox"},

						    {mc:PG_3.days, type:"comboBox"},

						    {mc:PG_3.evenings, type:"comboBox"},

						    {mc:PG_3.nights, type:"comboBox"},

						    {mc:PG_4.high_school_from, type:"Date"},

						    {mc:PG_4.high_school_to, type:"Date"},

						    {mc:PG_4.whenHS.high_school_when, type:"Date"},

						    {mc:PG_2.prevWork.prev_emplofrom, type:"Date"},

						    {mc:PG_2.prevWork.prev_emploto, type:"Date"},

						    {mc:PG_7.skill_medterm_date, type:"Date"},

						    {mc:PG_4.college_from, type:"Date"},

						    {mc:PG_4.college_to, type:"Date"},

						    {mc:PG_4.C1_When.college_when, type:"Date"},

						    {mc:PG_4.college2_from, type:"Date"},

						    {mc:PG_4.college2_to, type:"Date"},

						    {mc:PG_4.C2_When.college2_when, type:"Date"},

						    {mc:PG_5.college3_from, type:"Date"},

						    {mc:PG_5.college3_to, type:"Date"},

						    {mc:PG_5.C3_When.college3_when, type:"Date"},

						    {mc:PG_5.college4_from, type:"Date"},

						    {mc:PG_5.college4_to, type:"Date"},

						    {mc:PG_5.C4_When.college4_when, type:"Date"},

						    {mc:PG_5.crrentEd.current_ed_completdate, type:"Date"},

						    {mc:PG_6.LENTER.license_xdate, type:"Date"},

						    {mc:PG_6.LENTER.license2_xdate, type:"Date"},

						    {mc:PG_9.em_data_rec_brith, type:"Date"},

						    {mc:PG_1.lastname, type:"textInput"},

						    {mc:PG_1.firstname, type:"textInput"},

						    {mc:PG_1.middlename, type:"textInput"},

						    {mc:PG_1.suffix, type:"textInput"},

						    {mc:PG_1.ssn, type:"textInput"},

						    {mc:PG_1.street, type:"textInput"},

						    {mc:PG_1.city, type:"textInput"},

						    {mc:PG_1.zip, type:"textInput"},

						    {mc:PG_1.primphone, type:"textInput"},

						    {mc:PG_1.altphone, type:"textInput"},

						    {mc:PG_1.email, type:"textInput"},

						    {mc:PG_2.emerg_con, type:"textInput"},

						    {mc:PG_2.emerg_connumber, type:"textInput"},

						    {mc:PG_2.learnabout_job_othertxt, type:"textInput"},

						    {mc:PG_2.econ.econtact1.relative_name, type:"textInput"},

						    {mc:PG_2.econ.econtact1.relative_rela, type:"textInput"},

						    {mc:PG_2.econ.econtact2.relative_name2, type:"textInput"},

						    {mc:PG_2.econ.econtact2.relative_rela2, type:"textInput"},

						    {mc:PG_2.econ.econtact3.relative_name3, type:"textInput"},

						    {mc:PG_2.econ.econtact3.relative_rela3, type:"textInput"},

						    {mc:PG_4.high_school_name, type:"textInput"},

						    {mc:PG_4.high_school_loca, type:"textInput"},

						    {mc:PG_4.college_name, type:"textInput"},

						    {mc:PG_4.college_loca, type:"textInput"},

						    {mc:PG_4.college2_name, type:"textInput"},

						    {mc:PG_4.college2_loca, type:"textInput"},

						    {mc:PG_5.college3_name, type:"textInput"},

						    {mc:PG_5.college3_loca, type:"textInput"},

						    {mc:PG_5.college4_name, type:"textInput"},

						    {mc:PG_5.college4_loca, type:"textInput"},

						    {mc:PG_4.college_major, type:"textInput"},

						    {mc:PG_4.college2_major, type:"textInput"},

						    {mc:PG_5.college3_major, type:"textInput"},

						    {mc:PG_5.college4_major, type:"textInput"},

						    {mc:PG_5.crrentEd.current_ed_name, type:"textInput"},

						    {mc:PG_5.crrentEd.current_ed_loca, type:"textInput"},

						    {mc:PG_5.crrentEd.current_ed_study, type:"textInput"},

						    {mc:PG_6.LENTER.license_type, type:"textInput"},

						    {mc:PG_6.LENTER.license_number, type:"textInput"},

						    {mc:PG_6.LENTER.license_state, type:"textInput"},

						    {mc:PG_6.LENTER.license2_type, type:"textInput"},

						    {mc:PG_6.LENTER.license2_number, type:"textInput"},

						    {mc:PG_6.LENTER.license2_state, type:"textInput"},

						    {mc:PG_7.skill_typn_wpm, type:"textInput"},

						    {mc:PG_7.skill_medterm_school, type:"textInput"},

						    {mc:PG_7.skill_monitors_type, type:"textInput"},

						    {mc:PG_10.Alt_NAME.leg_othername_1, type:"textInput"},

						    {mc:PG_10.Alt_NAME.leg_othername_2, type:"textInput"},

						    {mc:PG_10.Alt_NAME.leg_othername_3, type:"textInput"},

						    {mc:PG_10.Alt_NAME.leg_othername_4, type:"textInput"},

						    {mc:PG_10.LEG_Able.leg_able_work_note, type:"textInput"},

						    {mc:PG_10.LEG_Convic.leg_convic_note, type:"textInput"},

						    {mc:PG_9.em_data_rec_name, type:"textInput"},

						    {mc:PG_9.em_data_rec_ssn, type:"textInput"},

						    {mc:PG_9.em_data_rec_notes, type:"textInput"},

						    {mc:PG_11.digitalsign, type:"textInput"},

						    {mc:PG_3.full_time, type:"checkBox"},

						    {mc:PG_3.part_time, type:"checkBox"},

						    {mc:PG_3.temp, type:"checkBox"},

						    {mc:PG_3.on_call, type:"checkBox"},

						    {mc:PG_3.avaiable_mon, type:"checkBox"},

						    {mc:PG_3.avaiable_tus, type:"checkBox"},

						    {mc:PG_3.avaiable_wed, type:"checkBox"},

						    {mc:PG_3.avaiable_thru, type:"checkBox"},

						    {mc:PG_3.avaiable_fri, type:"checkBox"},

						    {mc:PG_3.avaiable_sat, type:"checkBox"},

						    {mc:PG_3.avaiable_sun, type:"checkBox"},

						    {mc:PG_1.ssnoptout, type:"checkBox"},

						    {mc:PG_2.learnabout_job_ad, type:"checkBox"},

						    {mc:PG_2.learnabout_job_friend, type:"checkBox"},

						    {mc:PG_2.learnabout_job_other, type:"checkBox"},

						    {mc:PG_7.skill_typn, type:"checkBox"},

						    {mc:PG_7.skill_dataentry, type:"checkBox"},

						    {mc:PG_7.skill_medterm, type:"checkBox"},

						    {mc:PG_7.skill_medtrans, type:"checkBox"},

						    {mc:PG_7.skill_accounting, type:"checkBox"},

						    {mc:PG_7.skill_insure_bill, type:"checkBox"},

						    {mc:PG_7.skill_credit_collect, type:"checkBox"},

						    {mc:PG_7.skill_switchborad, type:"checkBox"},

						    {mc:PG_7.skill_cashier, type:"checkBox"},

						    {mc:PG_7.skill_10key, type:"checkBox"},

						    {mc:PG_7.skill_invoicing, type:"checkBox"},

						    {mc:PG_7.skill_reception, type:"checkBox"},

						    {mc:PG_7.skill_floorcare_man, type:"checkBox"},

						    {mc:PG_7.skill_floorcare_mac, type:"checkBox"},

						    {mc:PG_7.skill_dishman, type:"checkBox"},

						    {mc:PG_7.skill_dishindus, type:"checkBox"},

						    {mc:PG_7.skill_linen, type:"checkBox"},

						    {mc:PG_7.skill_sterilizer, type:"checkBox"},

						    {mc:PG_7.skill_autoclave, type:"checkBox"},

						    {mc:PG_7.skill_sewing, type:"checkBox"},

						    {mc:PG_7.skill_maintengen, type:"checkBox"},

						    {mc:PG_7.skill_maintencraft, type:"checkBox"},

						    {mc:PG_7.skill_maintencraft_el, type:"checkBox"},

						    {mc:PG_7.skill_maintencraft_pl, type:"checkBox"},

						    {mc:PG_7.skill_maintencraft_co, type:"checkBox"},

						    {mc:PG_7.skill_maintencraft_pt, type:"checkBox"},

						    {mc:PG_7.skill_steriletechique, type:"checkBox"},

						    {mc:PG_7.skill_vitalsigns, type:"checkBox"},

						    {mc:PG_7.skill_charting, type:"checkBox"},

						    {mc:PG_7.skill_pre_opprep, type:"checkBox"},

						    {mc:PG_7.skill_isolation, type:"checkBox"},

						    {mc:PG_7.skill_cateterization, type:"checkBox"},

						    {mc:PG_7.skill_coronarycare, type:"checkBox"},

						    {mc:PG_7.skill_intensive, type:"checkBox"},

						    {mc:PG_7.skill_monitors, type:"checkBox"},

						    {mc:PG_7.skill_orthopedic, type:"checkBox"},

						    {mc:PG_7.skill_pediatic, type:"checkBox"},

						    {mc:PG_7.skill_obstertrics, type:"checkBox"},

						    {mc:PG_7.skill_medical, type:"checkBox"},

						    {mc:PG_7.skill_surgical, type:"checkBox"},

						    {mc:PG_7.skill_geriatric, type:"checkBox"},

						    {mc:PG_7.skill_oncology, type:"checkBox"},

						    {mc:PG_7.skill_family_homecare, type:"checkBox"},

						    {mc:PG_9.em_data_rec_w, type:"checkBox"},

						    {mc:PG_9.em_data_rec_b, type:"checkBox"},

						    {mc:PG_9.em_data_rec_h, type:"checkBox"},

						    {mc:PG_9.em_data_rec_a, type:"checkBox"},

						    {mc:PG_9.em_data_rec_a_i, type:"checkBox"},

						    {mc:PG_9.em_data_rec_v, type:"checkBox"},

						    {mc:PG_9.em_data_rec_d, type:"checkBox"},

						    {mc:PG_9.em_data_rec_di, type:"checkBox"},

						    {mc:PG_leg.appstate_cb, type:"checkBox"},

						    {mc:PG_leg.drugtest, type:"checkBox"},

						    {mc:PG_11.digital_agree, type:"checkBox"},

							{chkYes:PG_8.addEmplyor.Em_HIS_Con_Y, chkNo:PG_8.addEmplyor.Em_HIS_Con_N, type:"checkBoxYN"},

							{chkYes:PG_3.rotate_shifts_Y, chkNo:PG_3.rotate_shifts_N, type:"checkBoxYN"},

							{chkYes:PG_3.weekends_Y, chkNo:PG_3.weekends_N, type:"checkBoxYN"},

							{chkYes:PG_2.relativeemplo_Y, option:PG_2.econ, optionVal:51.8, chkNo:PG_2.relativeemplo_N, type:"checkBoxYN"},

							{chkYes:PG_4.high_school_did_atend_Y, option:PG_4.whenHS, optionVal:396.1, chkNo:PG_4.high_school_did_atend_N, type:"checkBoxYN"},

							{chkYes:PG_4.college_did_atend_Y, option:PG_4.C1_When, optionVal:395.3, chkNo:PG_4.college_did_atend_N, type:"checkBoxYN"},

							{chkYes:PG_4.college2_did_atend_Y, option:PG_4.C2_When, optionVal:395.3, chkNo:PG_4.college2_did_atend_N, type:"checkBoxYN"},

							{chkYes:PG_5.college3_did_atend_Y, option:PG_5.C3_When, optionVal:395.3, chkNo:PG_5.college3_did_atend_N, type:"checkBoxYN"},

							{chkYes:PG_5.college4_did_atend_Y, option:PG_5.C4_When, optionVal:395.3, chkNo:PG_5.college4_did_atend_N, type:"checkBoxYN"},

							{chkYes:PG_5.current_ed_Y, option:PG_5.crrentEd, optionVal:25, chkNo:PG_5.current_ed_N, type:"checkBoxYN"},

							{chkYes:PG_6.licensed_Y, option:PG_6.LENTER, optionVal:45.0, chkNo:PG_6.licensed_N, type:"checkBoxYN"},

							{chkYes:PG_6.LApplied.app4license_Y, option:PG_6.LApplied, optionVal:57.0, chkNo:PG_6.LApplied.app4license_N, type:"checkBoxYN"},

							{chkYes:PG_10.leg_othername_Y, option:PG_10.Alt_NAME, optionVal:100.8,  chkNo:PG_10.leg_othername_N, type:"checkBoxYN"},

							{chkYes:PG_10.leg_able_work_Y, chkNo:PG_10.leg_able_work_N, type:"checkBoxYN"},

							{chkYes:PG_10.leg_visa_Y, chkNo:PG_10.leg_visa_N, type:"checkBoxYN"},

							{chkYes:PG_9.em_data_rec_sex_F, chkNo:PG_9.em_data_rec_sex_M, type:"checkBoxYN"},

							{chkYes:PG_10.leg_convic_Y, chkNo:PG_10.leg_convic_N, type:"checkBoxYN"},

						    {chkYes:PG_2._18_Y, chkNo:PG_2._18_N, type:"checkBoxYN"},

						    {chkYes:PG_2.prev_emplo_Y, chkNo:PG_2.prev_emplo_N, option:PG_2.prevWork, optionVal:230.7, type:"checkBoxYN"});
 

for (var i = 0; i<fieldArray.length; i++) {

	switch (fieldArray[i].type) {

		case "textInput" :

			fieldArray[i].mc.addEventListener("change",onSelect_text);

			break;

		case "checkBox" :

			fieldArray[i].mc.addEventListener("click",onSelected);

			fieldArray[i].option._x = 2000;

			runFuntionSwitch();

			break;

		case "checkBoxYN" :

			fieldArray[i].chkYes.addEventListener("click",checkBoxListener);

			fieldArray[i].chkNo.addEventListener("click",checkBoxListener);

			fieldArray[i].option._x = 2000;

			break;

		case "comboBox" :

			fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

			break;

		case "Date" :

			fieldArray[i].mc.addEventListener("change",onSelect_Date);

			break;

		case "YES_NO" :

			fieldArray[i].mc.addEventListener("click",onSelectedPath);

			break;

	}
 

	

	

	

}
 
 
 
 

// Date.toString() returns the current date and time

var myDate:Date = new Date();

trace(myDate.toString());// output: [current date and time]
 
 

import flash.external.ExternalInterface;

function getTextFromJavaScript(str:String):Void {

	ObjectToPass = "From JavaScript: "+str;

	///need to add: get input id suffix

}

ExternalInterface.addCallback("sendTextToFlash",this,getTextFromJavaScript);
 

//and one to catch what comes back
 

dataSender = new LoadVars();

dataReceiver = new LoadVars();

dataReceiver.onLoad = function() {

	if (this.response == "invalid") {

		alert_txt.text = "Please check from.";

	} else if (this.response == "error") {

		alert_txt.text = "Please check from.";

	} else if (this.response == "passed") {

		alert_txt.text = "Please check from.";

		ExternalInterface.call("formSubmit");

	}

};
 
 

function clickSend(eventObj:Object):Void {

	var jsArgument:String = outPutArray;

	var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

	ObjectToPass = "m7feu_input_"+result;

	trace("sent");

}

onEnterFrame(load);

{

	var FullArray:String = "{name:value}";

	//_global.FullArray = new Array();

	_global.outPutArray = new Array();

	_global.testIfSelected = function(t) {

		for (i=0; i<outPutArray.length; i++) {

			if (outPutArray[i] == t) {

				return i;

			}

		}

		return -1;

	};

};
 
 

////job

var JOBdgListener:Object = new Object();

JOBdgListener.change = function(evt_obj:Object) {
 

	trace("The selection has changed to "+evt_obj.target.selectedIndex);

	trace("Selected items: "+evt_obj.target.selectedItems);

	var s:String = "";

	var myObjArray:Array = evt_obj.target.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(evt_obj.target._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

};

// Add listener.

Starts.jobs_picks.addEventListener("change",JOBdgListener);
 
 
 
 
 
 
 
 

/// List components /data grid
 

var dgListener:Object = new Object();

dgListener.change = function(evt_obj:Object) {
 

	PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	trace("The selection has changed to "+evt_obj.target.selectedIndex);

	trace("Selected items: "+evt_obj.target.selectedItems);

	var s:String = "";

	var myObjArray:Array = evt_obj.target.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(evt_obj.target._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

};

// Add listener.

PG_8.emps_grd.addEventListener("change",dgListener);
 

DGlistenerObject = new Object();

DGlistenerObject.cellFocusOut = function(eventObject) {

	PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	trace("cellFocusOut");

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

};

PG_8.emps_grd.addEventListener("cellFocusOut",DGlistenerObject);

DGlistenerObject.cellFocusIn = function(eventObject) {

	PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	trace("cellFocusIn");

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	trace(outPutArray);

	clickSend();

};

PG_8.emps_grd.addEventListener("cellFocusIn",DGlistenerObject);
 
 

////date

function onSelect_Date() {

	trace(this._name);

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedDate);

	}

	trace(outPutArray);

	clickSend();

}

/// comobo box 

function onSelect_cbItemPicked() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedItem.data);

	}

	trace(outPutArray);

	clickSend();

}
 

/// TextInput 

function onSelect_text() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.text);

	}

	trace(outPutArray);

	clickSend();

}
 
 
 

////for single cb

function onSelected(checkbox) {

	var pos = testIfSelected(this._name);

	if (this.selected == true) {

		fieldArray[i].option._x = fieldArray[i].optionVal;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+":"+this.label);

		}

		trace(outPutArray);

	} else if (this.selected == false) {

		fieldArray[i].option._x = 2000;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+":na");

		}

		trace(outPutArray);

	} else {

		fieldArray[i].option._x = 2000;

		if (pos>=0) {

			outPutArray.splice(pos,1);

		}

		trace(outPutArray);

	}

	clickSend();

}

PG_1.ssnMask._x = 2000;

PG_1.N1._x = 2000;

function onSelectAPP_SSNoptOUT(checkbox) {

	if (PG_1.ssnoptout.selected == true) {

		PG_1.ssn.text = "";

		PG_1.ssn.enabled = false;

		PG_1.ssn.maxChars = 0;

		PG_1.ssnMask._x = 42.9;

		PG_1.N1._x = 249;

	} else {

		PG_1.ssnMask._x = 2000;

		PG_1.N1._x = 2000;

		PG_1.ssn.enabled = true;

		PG_1.ssn.maxChars = 9;

		PG_1.ssn.text = "";

	}

}

PG_1.ssnoptout.addEventListener("click", onSelectAPP_SSNoptOUT);
 

function checkBoxListener(evt) {

	for (i=0; i<fieldArray.length; i++) {

			if(fieldArray[i].optionFunc == "true"){

				runFuntionSwitch(fieldArray[i].optionFuncName);

			}

			fieldArray[i].option._x = 2000;

		if (fieldArray[i].chkYes == evt.target) {

			trace("event traget chkYes rechaced");

			if (fieldArray[i].chkYes.selected=true) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = fieldArray[i].optionVal;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Yes");

				}

				trace(outPutArray);

				trace(evt.target._name+":Yes");

				clickSend();

			} else if (fieldArray[i].chkYes.selected=false) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else if (fieldArray[i].chkNo == evt.target) {

			trace("event traget chkNo rechaced");

			if (fieldArray[i].chkNo.selected=true) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":No");

				}

				trace(evt.target._name+":No");

				trace(outPutArray);

				clickSend();

			} else if (fieldArray[i].chkNo.selected=false) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else {

			trace("fail");

		}

	}

}
 

//////////////////

/// on submit

//////////////////

Bar.Send.onRelease = function() {

	var FullArray:String = "{name:value}";

	for (var i = 0; i<fieldArray.length; i++) {

		switch (fieldArray[i].type) {

			case "textInput" :

				fieldArray[i].mc.addEventListener("change",onSelect_text);

				var pos = testIfSelected(this._name);

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.text);

				}

				FullArray = FullArray+",{"+outPutArray+"}";

				//trace(outPutArray);

				clickSend();

				break;

			case "checkBox" :

				fieldArray[i].mc.addEventListener("click",onSelected);

				var pos = testIfSelected(this._name);

				if (fieldArray[i].mc.selected == true) {

					outPutArray.splice(pos,1);

					if (pos == -1) {

						outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.label);

					}

					FullArray = FullArray+",{"+outPutArray+"}";

					trace(outPutArray);

				} else if (fieldArray[i].mc.selected == false) {

					outPutArray.splice(pos,1);

					if (pos == -1) {

						outPutArray.push(fieldArray[i].mc._name+":na");

					}

					FullArray = FullArray+",{"+outPutArray+"}";

					//trace(outPutArray);

				} else {

					if (pos>=0) {

						outPutArray.splice(pos,1);

					}

					FullArray = FullArray+",{"+outPutArray+"}";

					//trace(outPutArray);

				}

				clickSend();

				break;

			case "comboBox" :

				fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

				var pos = testIfSelected(this._name);

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedItem.data);

				}

				FullArray = FullArray+",{"+outPutArray+"}";

				//trace(outPutArray);

				clickSend();

				break;

			case "Date" :

				fieldArray[i].mc.addEventListener("change",onSelect_Date);
 

				var pos = testIfSelected(this._name);

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedDate);

				}

				FullArray = FullArray+",{"+outPutArray+"}";

				//trace(outPutArray);

				clickSend();

				break;

		}

	}

	//trace(FullArray);

	var postVars:LoadVars = new LoadVars();

	postVars.dataArray = FullArray;

	postVars.sendAndLoad("../Core_files/PDFgenerator/tcpdf_php4/examples/example_011.php",dataReceiver,"POST");

};

Open in new window

0
Comment
Question by:jeremyBass26
  • 20
  • 19
39 Comments
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21790595
One idea I have been trying throwing around is dynamically setting

var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"},ect.....,{chkYes:PG_8.addEmplyor.Em_HIS_Con_Y, chkNo:PG_8.addEmplyor.Em_HIS_Con_N, type:"checkBoxYN"});
http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/ActionScript/Q__23466470.html

it was thought that maybe a super strict naming system could work... but Im not seeing it... Ive done some parting of name to get what I want but that was limited...see the RegExp; in file and code below...
http://filedb.experts-exchange.com/incoming/2008/06_w24/32901/ex.fla.zip

I'd think the  names would have to be some thing weird like
      from
      PG_10.leg_convic_Y
      to
      PG_10.checkBoxYN|leg_convic_Y

it'd have to be something like this
      location.values|mcInstanceName

as the mcInstanceName is used at the end leaving only the middle open (or beginning of the mcInstanceName)

But I have not been able to account for how... and that is much more complicated then i currently can do easy or hard ....

another thought was may-be using the api to draw the 200 fields? would that help with the file size?

I know that'd make the name much harder lol...

Any one have a thought?  Thanks  : )

import RegExp;

function strip_Y(str:String):String {

	var strip_YRegExp = new RegExp("(_Y)", "g");

	return str.replace(strip_YRegExp, "");

}

function strip_N(str:String):String {

	var strip_NRegExp = new RegExp("(_N)", "g");

	return str.replace(strip_NRegExp, "");

}

var ya:Object = null;

var na:Object = null;

function onSelectedPath(evt) {

	body = evt.target._parent._name+"."+evt.target._name;
 

	var NStage1 = strip_Y(body);

	var FINResult = strip_N(NStage1);
 

	trace(FINResult);

	ya = FINResult+"_Y";

	na = FINResult+"_N";

	trace(ya);

	trace(na);

	if (ya == evt.target._parent._name+"."+evt.target._name) {

		trace("onSelect_Yes:"+ya);

		trace("onSelect_Yes:"+na);

		var pos = testIfSelected(evt.target._name);

		if (ya == FINResult+"_Y") {

			ya.selected = true;

			na.selected = false;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":Yes");

			}

			trace(outPutArray);

			clickSend();

		} else if (na=FINResult+"_N") {

			na.selected = true;

			ya.selected = false;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":No");

			}

			trace(outPutArray);

			clickSend();

		} else {

			na.selected = false;

			ya.selected = false;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":Ynull");

			}

			trace(outPutArray);

			clickSend();

		}

	} else if (na == evt.target._parent._name+"."+evt.target._name) {

		trace("onSelect_No:"+ya);

		trace("onSelect_No:"+na);

		var pos = testIfSelected(evt.target._name);

		if (na=FINResult+"_N") {

			ya.selected = false;

			na.selected = true;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":No");

			}

			trace(outPutArray);

			clickSend();

		} else if (ya == FINResult+"_Y") {

			na.selected = true;

			ya.selected = false;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":Yes");

			}

			trace(outPutArray);

			clickSend();

		} else {

			na.selected = false;

			ya.selected = false;

			outPutArray.splice(pos,1);

			if (pos == -1) {

				outPutArray.push(evt.target._name+":Nnull");

			}

			trace(outPutArray);

			clickSend();

		}

	} else {

		trace("fail");

	}

}*/

Open in new window

0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21790596
Also I think the emps data grids could be compacted but ... yeah clueless there...
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21792487
You have some challenges ahead of you. :-)

One thing to consider though is that you don't want to trade code readability
for compactness.

Have you thought of using something like packer (e.g., http://dean.edwards.name/packer/) to compress the code, and see how
much the compression saves you?

That way, you could keep, and work with the original code, and use the
compressed version on your page(s).

Some things did come to mind though while I looked at your code.
For example, instead of using:

--------------------------------------------------
// Alter DataGrid dimensions.
PG_8.emps_grd.columnNames = ["Employer", "Address", "Phone", "Supervisor", "Contact", "Wage", "Duties", "From", "To", "Reason"];
PG_8.emps_grd.getColumnAt(0).width = 90;
PG_8.emps_grd.getColumnAt(1).width = 100;
PG_8.emps_grd.getColumnAt(2).width = 70;
PG_8.emps_grd.getColumnAt(3).width = 100;
PG_8.emps_grd.getColumnAt(4).width = 50;
PG_8.emps_grd.getColumnAt(5).width = 60;
PG_8.emps_grd.getColumnAt(6).width = 120;
PG_8.emps_grd.getColumnAt(7).width = 50;
PG_8.emps_grd.getColumnAt(8).width = 50;
PG_8.emps_grd.getColumnAt(9).width = 120;
--------------------------------------------------

You might want to use something like:

--------------------------------------------------
var emps_grd = PG_8.emps_grd;
emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );
var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );
getCol = PG_8.emps_grd.getColumnAt
for ( var i = 0; i < widths.length; i++ ) {
  getCol( i ) = parseInt( widths[ i ] );
}
--------------------------------------------------

and since all of your widths are nice multiples of 10, you could even do this:
--------------------------------------------------
var widths = '9,10,7,10,5,6,12,5,5,12'.split( ',' );
getCol = PG_8.emps_grd.getColumnAt
for ( var i = 0; i < widths.length; i++ ) {
  getCol( i ) = parseInt( widths[ i ] ) * 10;
}
--------------------------------------------------

You have all sorts of options.
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21794613
I like the idea... but I get any error "Left side of assignment operator must be variable or property."
for
getCol( i ) = parseInt( widths[ i ] ) * 10;

I'v run into this once before.. but i don't think i worked it out... ideas?

I tried out the packer, but the file size went from186 to 186 so not much savings there....

I'll have to find more tricks and work this good... :)
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21794780
hm, that would get to imply that the assignment of getCol didn't create or assign
a reference to the PG_8.emps_grd.getColumnAt item as expected.

What do you get if you add:

alert( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );

0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21794794
btw:

  It would probably be best to add "var" in front of the getCol definition, like:

var getCol = PG_8.emps_grd.getColumnAt;
alert( ... );
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21804303
Rock on i'll try that in a bit... any other ideas.... ? may-be on how to read the components out of the file? well thanks for the help...
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21805105
Look for refactoring (http://en.wikipedia.org/wiki/Refactoringhttp://en.wikipedia.org/wiki/Refactoring)
opportunities.

For example, you have multiple assignments like:
  ...selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

- lines 565, 596, 623
- Have one instance of this array, and have the assigments be to this global variable
  instance
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21809798
Not a prob, I got bogged down again today and can't get on this until Tomorrow anyways... same for the other post... but Ill post the same line in there as well... thank you again for the help... I'm learning a lot going through this...

jeremyBass
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21811982
Good.  That is one of the reasons I do this.  To work with people so we can both
learn something.
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21842891
Hello, sorry for the long delay... I had one busy week lol... well so below is the first refactoring pass... (along with some function fixes) I know there is lots could be done, but this is a start... see any more?... any tricks?

I am really starting to see through a coders eyes... who knows, may-be by the end of the project, this designer will have the rights to say he's a coder as well ... lol ... Thanks for the help on this...

Still can't get this to work...

var emps_grd = PG_8.emps_grd;
var getCol = PG_8.emps_grd.getColumnAt;
emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );
var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );
getCol = PG_8.emps_grd.getColumnAt
for ( var i = 0; i < widths.length; i++ ) {
  getCol = parseInt( widths[ i ] );
}


this get:

trace( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );


gets:

getCol: number
getColumnAt: function
 are identical: false
undefined
var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"}, {mc:PG_1.urstate, type:"comboBox"}, {mc:PG_1.primphonetype, type:"comboBox"}, {mc:PG_1.altphonetype, type:"comboBox"}, {mc:PG_2.emerg_contype, type:"comboBox"}, {mc:PG_3.days, type:"comboBox"}, {mc:PG_3.evenings, type:"comboBox"}, {mc:PG_3.nights, type:"comboBox"}, {mc:PG_4.high_school_from, type:"Date"}, {mc:PG_4.high_school_to, type:"Date"}, {mc:PG_4.whenHS.high_school_when, type:"Date"}, {mc:PG_2.prevWork.prev_emplofrom, type:"Date"}, {mc:PG_2.prevWork.prev_emploto, type:"Date"}, {mc:PG_7.skill_medterm_date, type:"Date"}, {mc:PG_4.college_from, type:"Date"}, {mc:PG_4.college_to, type:"Date"}, {mc:PG_4.C1_When.college_when, type:"Date"}, {mc:PG_4.college2_from, type:"Date"}, {mc:PG_4.college2_to, type:"Date"}, {mc:PG_4.C2_When.college2_when, type:"Date"}, {mc:PG_5.college3_from, type:"Date"}, {mc:PG_5.college3_to, type:"Date"}, {mc:PG_5.C3_When.college3_when, type:"Date"}, {mc:PG_5.college4_from, type:"Date"}, {mc:PG_5.college4_to, type:"Date"}, {mc:PG_5.C4_When.college4_when, type:"Date"}, {mc:PG_5.crrentEd.current_ed_completdate, type:"Date"}, {mc:PG_6.LENTER.license_xdate, type:"Date"}, {mc:PG_6.LENTER.license2_xdate, type:"Date"}, {mc:PG_9.em_data_rec_brith, type:"Date"}, {mc:PG_1.lastname, type:"textInput"}, {mc:PG_1.firstname, type:"textInput"}, {mc:PG_1.middlename, type:"textInput"}, {mc:PG_1.suffix, type:"textInput"}, {mc:PG_1.ssn, type:"textInput"}, {mc:PG_1.street, type:"textInput"}, {mc:PG_1.city, type:"textInput"}, {mc:PG_1.zip, type:"textInput"}, {mc:PG_1.primphone, type:"textInput"}, {mc:PG_1.altphone, type:"textInput"}, {mc:PG_1.email, type:"textInput"}, {mc:PG_2.emerg_con, type:"textInput"}, {mc:PG_2.emerg_connumber, type:"textInput"}, {mc:PG_2.learnabout_job_othertxt, type:"textInput"}, {mc:PG_2.econ.econtact1.relative_name, type:"textInput"}, {mc:PG_2.econ.econtact1.relative_rela, type:"textInput"}, {mc:PG_2.econ.econtact2.relative_name2, type:"textInput"}, {mc:PG_2.econ.econtact2.relative_rela2, type:"textInput"}, {mc:PG_2.econ.econtact3.relative_name3, type:"textInput"}, {mc:PG_2.econ.econtact3.relative_rela3, type:"textInput"}, {mc:PG_4.high_school_name, type:"textInput"}, {mc:PG_4.high_school_loca, type:"textInput"}, {mc:PG_4.college_name, type:"textInput"}, {mc:PG_4.college_loca, type:"textInput"}, {mc:PG_4.college2_name, type:"textInput"}, {mc:PG_4.college2_loca, type:"textInput"}, {mc:PG_5.college3_name, type:"textInput"}, {mc:PG_5.college3_loca, type:"textInput"}, {mc:PG_5.college4_name, type:"textInput"}, {mc:PG_5.college4_loca, type:"textInput"}, {mc:PG_4.college_major, type:"textInput"}, {mc:PG_4.college2_major, type:"textInput"}, {mc:PG_5.college3_major, type:"textInput"}, {mc:PG_5.college4_major, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_name, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_loca, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_study, type:"textInput"}, {mc:PG_6.LENTER.license_type, type:"textInput"}, {mc:PG_6.LENTER.license_number, type:"textInput"}, {mc:PG_6.LENTER.license_state, type:"textInput"}, {mc:PG_6.LENTER.license2_type, type:"textInput"}, {mc:PG_6.LENTER.license2_number, type:"textInput"}, {mc:PG_6.LENTER.license2_state, type:"textInput"}, {mc:PG_7.skill_typn_wpm, type:"textInput"}, {mc:PG_7.skill_medterm_school, type:"textInput"}, {mc:PG_7.skill_monitors_type, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_1, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_2, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_3, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_4, type:"textInput"}, {mc:PG_10.LEG_Able.leg_able_work_note, type:"textInput"}, {mc:PG_10.LEG_Convic.leg_convic_note, type:"textInput"}, {mc:PG_9.em_data_rec_name, type:"textInput"}, {mc:PG_9.em_data_rec_ssn, type:"textInput"}, {mc:PG_9.em_data_rec_notes, type:"textInput"}, {mc:PG_11.digitalsign, type:"textInput"}, {mc:PG_3.full_time, type:"checkBox"}, {mc:PG_3.part_time, type:"checkBox"}, {mc:PG_3.temp, type:"checkBox"}, {mc:PG_3.on_call, type:"checkBox"}, {mc:PG_3.avaiable_mon, type:"checkBox"}, {mc:PG_3.avaiable_tus, type:"checkBox"}, {mc:PG_3.avaiable_wed, type:"checkBox"}, {mc:PG_3.avaiable_thru, type:"checkBox"}, {mc:PG_3.avaiable_fri, type:"checkBox"}, {mc:PG_3.avaiable_sat, type:"checkBox"}, {mc:PG_3.avaiable_sun, type:"checkBox"}, {mc:PG_1.ssnoptout, type:"checkBox"}, {mc:PG_2.learnabout_job_ad, type:"checkBox"}, {mc:PG_2.learnabout_job_friend, type:"checkBox"}, {mc:PG_2.learnabout_job_other, type:"checkBox"}, {mc:PG_7.skill_typn, type:"checkBox"}, {mc:PG_7.skill_dataentry, type:"checkBox"}, {mc:PG_7.skill_medterm, type:"checkBox"}, {mc:PG_7.skill_medtrans, type:"checkBox"}, {mc:PG_7.skill_accounting, type:"checkBox"}, {mc:PG_7.skill_insure_bill, type:"checkBox"}, {mc:PG_7.skill_credit_collect, type:"checkBox"}, {mc:PG_7.skill_switchborad, type:"checkBox"}, {mc:PG_7.skill_cashier, type:"checkBox"}, {mc:PG_7.skill_10key, type:"checkBox"}, {mc:PG_7.skill_invoicing, type:"checkBox"}, {mc:PG_7.skill_reception, type:"checkBox"}, {mc:PG_7.skill_floorcare_man, type:"checkBox"}, {mc:PG_7.skill_floorcare_mac, type:"checkBox"}, {mc:PG_7.skill_dishman, type:"checkBox"}, {mc:PG_7.skill_dishindus, type:"checkBox"}, {mc:PG_7.skill_linen, type:"checkBox"}, {mc:PG_7.skill_sterilizer, type:"checkBox"}, {mc:PG_7.skill_autoclave, type:"checkBox"}, {mc:PG_7.skill_sewing, type:"checkBox"}, {mc:PG_7.skill_maintengen, type:"checkBox"}, {mc:PG_7.skill_maintencraft, type:"checkBox"}, {mc:PG_7.skill_maintencraft_el, type:"checkBox"}, {mc:PG_7.skill_maintencraft_pl, type:"checkBox"}, {mc:PG_7.skill_maintencraft_co, type:"checkBox"}, {mc:PG_7.skill_maintencraft_pt, type:"checkBox"}, {mc:PG_7.skill_steriletechique, type:"checkBox"}, {mc:PG_7.skill_vitalsigns, type:"checkBox"}, {mc:PG_7.skill_charting, type:"checkBox"}, {mc:PG_7.skill_pre_opprep, type:"checkBox"}, {mc:PG_7.skill_isolation, type:"checkBox"}, {mc:PG_7.skill_cateterization, type:"checkBox"}, {mc:PG_7.skill_coronarycare, type:"checkBox"}, {mc:PG_7.skill_intensive, type:"checkBox"}, {mc:PG_7.skill_monitors, type:"checkBox"}, {mc:PG_7.skill_orthopedic, type:"checkBox"}, {mc:PG_7.skill_pediatic, type:"checkBox"}, {mc:PG_7.skill_obstertrics, type:"checkBox"}, {mc:PG_7.skill_medical, type:"checkBox"}, {mc:PG_7.skill_surgical, type:"checkBox"}, {mc:PG_7.skill_geriatric, type:"checkBox"}, {mc:PG_7.skill_oncology, type:"checkBox"}, {mc:PG_7.skill_family_homecare, type:"checkBox"}, {mc:PG_9.em_data_rec_w, type:"checkBox"}, {mc:PG_9.em_data_rec_b, type:"checkBox"}, {mc:PG_9.em_data_rec_h, type:"checkBox"}, {mc:PG_9.em_data_rec_a, type:"checkBox"}, {mc:PG_9.em_data_rec_a_i, type:"checkBox"}, {mc:PG_9.em_data_rec_v, type:"checkBox"}, {mc:PG_9.em_data_rec_d, type:"checkBox"}, {mc:PG_9.em_data_rec_di, type:"checkBox"}, {mc:PG_leg.appstate_cb, type:"checkBox"}, {mc:PG_leg.drugtest, type:"checkBox"}, {mc:PG_11.digital_agree, type:"checkBox"}, {chkYes:PG_8.addEmplyor.Em_HIS_Con_Y, chkNo:PG_8.addEmplyor.Em_HIS_Con_N, type:"checkBoxYN"}, {chkYes:PG_3.rotate_shifts_Y, chkNo:PG_3.rotate_shifts_N, type:"checkBoxYN"}, {chkYes:PG_3.weekends_Y, chkNo:PG_3.weekends_N, type:"checkBoxYN"}, {chkYes:PG_2.relativeemplo_Y, option:PG_2.econ, optionVal:51.8, chkNo:PG_2.relativeemplo_N, type:"checkBoxYN"}, {chkYes:PG_4.high_school_did_atend_Y, option:PG_4.whenHS, optionVal:396.1, chkNo:PG_4.high_school_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_4.college_did_atend_Y, option:PG_4.C1_When, optionVal:395.3, chkNo:PG_4.college_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_4.college2_did_atend_Y, option:PG_4.C2_When, optionVal:395.3, chkNo:PG_4.college2_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.college3_did_atend_Y, option:PG_5.C3_When, optionVal:395.3, chkNo:PG_5.college3_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.college4_did_atend_Y, option:PG_5.C4_When, optionVal:395.3, chkNo:PG_5.college4_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.current_ed_Y, option:PG_5.crrentEd, optionVal:25, chkNo:PG_5.current_ed_N, type:"checkBoxYN"}, {chkYes:PG_6.licensed_Y, option:PG_6.LENTER, optionVal:45.0, chkNo:PG_6.licensed_N, type:"checkBoxYN"}, {chkYes:PG_6.LApplied.app4license_Y, option:PG_6.LApplied, optionVal:57.0, chkNo:PG_6.LApplied.app4license_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_othername_Y, option:PG_10.Alt_NAME, optionVal:100.8, chkNo:PG_10.leg_othername_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_able_work_Y, chkNo:PG_10.leg_able_work_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_visa_Y, chkNo:PG_10.leg_visa_N, type:"checkBoxYN"}, {chkYes:PG_9.em_data_rec_sex_F, chkNo:PG_9.em_data_rec_sex_M, type:"checkBoxYN"}, {chkYes:PG_10.leg_convic_Y, chkNo:PG_10.leg_convic_N, type:"checkBoxYN"}, {chkYes:PG_2._18_Y, chkNo:PG_2._18_N, type:"checkBoxYN"}, {chkYes:PG_2.prev_emplo_Y, chkNo:PG_2.prev_emplo_N, option:PG_2.prevWork, optionVal:230.7, type:"checkBoxYN"});
 

for (var i = 0; i<fieldArray.length; i++) {

	fieldArray[i].option._x = 2000;

	switch (fieldArray[i].type) {

		case "textInput" :

			fieldArray[i].mc.addEventListener("change",onSelect_text);

			break;

		case "checkBox" :

			fieldArray[i].mc.addEventListener("click",onSelected);

			fieldArray[i].option._x = 2000;

			break;

		case "checkBoxYN" :

			fieldArray[i].chkYes.addEventListener("click",checkBoxListener);

			fieldArray[i].chkNo.addEventListener("click",checkBoxListener);
 

			break;

		case "comboBox" :

			fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

			break;

		case "Date" :

			fieldArray[i].mc.addEventListener("change",onSelect_Date);

			break;

		case "YES_NO" :

			fieldArray[i].mc.addEventListener("click",onSelectedPath);

			break;

	}

}
 

import flash.external.ExternalInterface;

function getTextFromJavaScript(str:String):Void {

	ObjectToPass = "From JavaScript: "+str;

	///need to add: get input id suffix

}

ExternalInterface.addCallback("sendTextToFlash",this,getTextFromJavaScript);
 

//and one to catch what comes back
 

dataSender = new LoadVars();

dataReceiver = new LoadVars();

dataReceiver.onLoad = function() {

	if (this.response == "invalid") {

		alert_txt.text = "Please check from.invalid";

	} else if (this.response == "error") {

		alert_txt.text = "Please check from.error";

	} else if (this.response == null) {

		alert_txt.text = "The server is haveing issues.";

	} else if (this.response == "passed") {

		alert_txt.text = "Submission completed.";

		ExternalInterface.call("formSubmit");

	}

};
 
 

function clickSend(eventObj:Object):Void {

	var jsArgument:String = outPutArray;

	var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

	ObjectToPass = "m7feu_input_"+result;

	trace("sent");

}

function phpSend(eventObj:Object):Void {

//	var jsArgument:String = complete_outPutArray;

//	var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

//	ObjectToPass = "m7feu_input_"+result;

	trace("sent");

}

onEnterFrame(load);

{

	var FullArray:String = "{name:value}";

	//_global.FullArray = new Array();

	_global.complete_outPutArray = new Array();

	_global.outPutArray = new Array();

	_global.testIfSelected = function(t) {

		for (i=0; i<complete_outPutArray.length; i++) {

			if (complete_outPutArray[i] == t) {

				return i;

			}

		}

		return -1;

	};

};
 
 

////job

var JOBdgListener:Object = new Object();

JOBdgListener.change = function(evt_obj:Object) {

onSelect_list(evt_obj);

};

// Add listener.

Starts.jobs_picks.addEventListener("change",JOBdgListener);
 

function onSelect_list(evt_obj) {

	trace("The selection has changed to "+evt_obj.target.selectedIndex);

	trace("Selected items: "+evt_obj.target.selectedItems);

	var s:String = "";

	var myObjArray:Array = evt_obj.target.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(evt_obj.target._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

}
 
 
 
 
 
 

/// List components /data grid

function onSelect_emps(evt_obj) {

PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

}
 
 
 

var dgListener:Object = new Object();

dgListener.change = function(evt_obj:Object) {

onSelect_emps(evt_obj);

	

};

PG_8.emps_grd.addEventListener("change",dgListener);
 

DGlistenerObject = new Object();

DGlistenerObject.cellFocusOut = function(eventObject) {

	onSelect_emps(evt_obj);

};

PG_8.emps_grd.addEventListener("cellFocusOut",DGlistenerObject);

DGlistenerObject.cellFocusIn = function(eventObject) {

	onSelect_emps(evt_obj);

};

PG_8.emps_grd.addEventListener("cellFocusIn",DGlistenerObject);
 
 

////date

function onSelect_Date() {

	trace(this._name);

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedDate);

	}

	trace(outPutArray);

	clickSend();

}

/// comobo box 

function onSelect_cbItemPicked() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedItem.data);

	}

	trace(outPutArray);

	clickSend();

}
 

/// TextInput 

function onSelect_text() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.text);

	}

	trace(outPutArray);

	clickSend();

}
 
 
 

////for single cb

function onSelected(checkbox) {

	var pos = testIfSelected(this._name);

	if (this.selected == true) {

		fieldArray[i].option._x = fieldArray[i].optionVal;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+":"+this.label);

		}

		trace(outPutArray);

	} else if (this.selected == false) {

		fieldArray[i].option._x = 2000;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+": ");

		}

		trace(outPutArray);

	} else {

		fieldArray[i].option._x = 2000;

		if (pos>=0) {

			outPutArray.splice(pos,1);

		}

		trace(outPutArray);

	}

	clickSend();

}

PG_1.ssnMask._x = 2000;

PG_1.N1._x = 2000;

function onSelectAPP_SSNoptOUT(checkbox) {

	if (PG_1.ssnoptout.selected == true) {

		PG_1.ssn.text = "";

		PG_1.ssn.enabled = false;

		PG_1.ssn.maxChars = 0;

		PG_1.ssnMask._x = 42.9;

		PG_1.N1._x = 249;

	} else {

		PG_1.ssnMask._x = 2000;

		PG_1.N1._x = 2000;

		PG_1.ssn.enabled = true;

		PG_1.ssn.maxChars = 9;

		PG_1.ssn.text = "";

	}

}

PG_1.ssnoptout.addEventListener("click",onSelectAPP_SSNoptOUT);

///Learn about job

PG_2.learnabout_job_othertxt._x = 2000;

function onSelectLearnAbout_Other(checkbox) {

	if (PG_2.learnabout_job_other.selected == true) {

		PG_2.learnabout_job_othertxt.text = "";

		PG_2.learnabout_job_othertxt._x = 277.2;

	} else {

		PG_2.learnabout_job_othertxt._x = 2000;

		PG_2.learnabout_job_othertxt.text = "";

	}

}

PG_2.learnabout_job_other.addEventListener("click", onSelectLearnAbout_Other);
 
 
 
 

function checkBoxListener(evt) {

	for (i=0; i<fieldArray.length; i++) {

		if (fieldArray[i].optionFunc == "true") {

			runFuntionSwitch(fieldArray[i].optionFuncName);

		}

		if (fieldArray[i].chkYes == evt.target) {

			trace("event traget chkYes rechaced");

			if (fieldArray[i].chkYes.selected=true) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = fieldArray[i].optionVal;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Yes");

				}

				trace(outPutArray);

				trace(evt.target._name+":Yes");

				clickSend();

			} else if (fieldArray[i].chkYes.selected=false) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else if (fieldArray[i].chkNo == evt.target) {

			trace("event traget chkNo rechaced");

			if (fieldArray[i].chkNo.selected=true) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":No");

				}

				trace(evt.target._name+":No");

				trace(outPutArray);

				clickSend();

			} else if (fieldArray[i].chkNo.selected=false) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._name._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else {

			trace("checking.... not it");

		}

	}

}
 
 
 
 
 
 
 
 
 

function submitTo() {

	var FullArray:String = "{name:value}";

	var myDate:Date = new Date();

	FullArray = FullArray+",{Applacation Date:"+myDate+"}";

	PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";

	var pos = testIfSelected(this._name);

	complete_outPutArray.splice(pos,1);

	if (pos == -1) {

		complete_outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	FullArray = FullArray+",{"+complete_outPutArray+"}";

	trace(complete_outPutArray);

	phpSend();

	

	var s:String = "";

	var myObjArray:Array = Starts.jobs_picks.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	complete_outPutArray.splice(pos,1);

	if (pos == -1) {

		complete_outPutArray.push(Starts.jobs_picks._name+":"+s);

	}

	FullArray = FullArray+",{"+complete_outPutArray+"}";

	trace(complete_outPutArray);

	phpSend();

	

	for (var i = 0; i<fieldArray.length; i++) {

		

		switch (fieldArray[i].type) {

			case "textInput" :

				fieldArray[i].mc.addEventListener("change",onSelect_text);

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.text);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "checkBox" :

				fieldArray[i].mc.addEventListener("click",onSelected);

				var pos = testIfSelected(this._name);

				if (fieldArray[i].mc.selected == true) {

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.label);

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				} else if (fieldArray[i].mc.selected == false) {

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].mc._name+":");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				} else {

					if (pos>=0) {

						complete_outPutArray.splice(pos,1);

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				}

				phpSend();

				break;

			case "comboBox" :

				fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedItem.data);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "Date" :

				fieldArray[i].mc.addEventListener("change",onSelect_Date);
 

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedDate);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "checkBoxYN" :

				fieldArray[i].chkYes.addEventListener("click",checkBoxListener);

				fieldArray[i].chkNo.addEventListener("click",checkBoxListener);

				if (fieldArray[i].chkYes.selected == true) {

					var pos = testIfSelected(fieldArray[i].chkYes._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkYes._name+":"+"Yes");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

					//trace(fieldArray[i].chkYes._name+":Yes");

					phpSend();

				} else if (fieldArray[i].chkNo.selected == true) {

					var pos = testIfSelected(fieldArray[i].chkNo._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkNo._name+":"+"No");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					//trace(fieldArray[i].chkNo._name+":No");

					trace(complete_outPutArray);

					phpSend();

				} else {

					var pos = testIfSelected(fieldArray[i].chkNo._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkNo._name+":"+"");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(fieldArray[i].chkNo._name+":"+"");

				}

				break;

		}

		

	}

	trace(FullArray);
 

}
 
 
 
 
 
 
 
 
 
 
 
 

//////////////////

/// on submit

//////////////////

Bar.Send.onRelease = function() {

	submitTo();

	var postVars:LoadVars = new LoadVars();

	postVars.dataArray = FullArray;

	postVars.sendAndLoad("../Core_files/PDFgenerator/tcpdf_php4/examples/example_011.php",dataReceiver,"POST");

};

Open in new window

0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21842896
Sorry this is the full script
////////Motion
 

import mx.transitions.Tween;

import mx.transitions.easing.*;

function fallin():Void {

	var myHoriTween:Tween = new Tween(Symbol, "_x", Back.easeInOut, -450, 10, 1.5, true);

}

function fallaway():Void {

	var xPositionT:Tween = new Tween(Symbol, "_x", Strong.easeOut, -50, 600, 2, true);

}
 
 

////XML dtat handling

Jobs_xmlc.trigger();

function sendHandler(ev:Object):Void {

	trace("Got Send Event at "+getTimer());

	//causes a movieclip named ball fade to an alpha of 40

}

function resultHandler(ev:Object):Void {

	trace("Got Result Event at "+getTimer());

	fallin();

	LoadingMC._x = 2000;

}

function statusHandler(ev:Object):Void {

	var statCode:String = ev.code;

	if (statCode == "StatusChange") {

		//Iignore StatusChange type events

	} else {

		trace("Got Status Event at "+getTimer()+" : Code is"+statCode);

		//fallin();

		trace("FaultCode: "+ev.data.faultcode);

		trace("FaultString: "+ev.data.faultstring);

	}

}

Jobs_xmlc.addEventListener("send", sendHandler);

Jobs_xmlc.addEventListener("result", resultHandler);

Jobs_xmlc.addEventListener("status", statusHandler);

//////TransFX
 
 
 
 
 

//////////////Employer datagrid

emps_xmlc.addEventListener("send", sendHandler);

emps_xmlc.addEventListener("result", resultHandler);

emps_xmlc.addEventListener("status", statusHandler);
 

///edit em

PG_8.addEmplyor.CloseX._width = 0;

emps_xmlc.trigger();

import mx.data.components.datasetclasses.DataSetIterator;

var intID:Number = setInterval(checkChanges, 100);

function checkChanges():Void {

	PG_8.addEmplyor.changesPending_ch.selected = emps_ds.changesPending();

}

PG_8.addEmplyor.CloseX.onRelease = function() {

	PG_8.addEmplyor.CloseX._width = 0;

	focusManager.setFocus(PG_8.emps_grd);

	PG_8.new_btn._x = 324.8;

	PG_8.delete_btn._x = 426.3;

	PG_8.addEmplyor.edit_btn._width = 100;

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 360, 351, 2, true);

};

PG_8.addEmplyor.new_btn.addEventListener("click", tabOpen);

PG_8.new_btn.onRelease = function() {

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 350, 117, 2, true);

	focusManager.setFocus(PG_8.emps_grd);

	PG_8.addEmplyor.CloseX._width = 24.1;

	PG_8.addEmplyor.edit_btn._width = 0;

	PG_8.new_btn._x = 2000;

	PG_8.delete_btn._x = 2000;

	

	emps_ds.addItem({Employer:"new Employee", dept:" ", sex:" "});

};

PG_8.addEmplyor.edit_btn.onRelease = function() {

	var xPositionT:Tween = new Tween(PG_8.addEmplyor, "_y", Strong.easeOut, 350, 117, 2, true);

	PG_8.addEmplyor.CloseX._width = 24.1;

	PG_8.addEmplyor.edit_btn._width = 0;

	PG_8.new_btn._x = 2000;

	PG_8.delete_btn._x = 2000;

	focusManager.setFocus(PG_8.emps_grd);

	

};

PG_8.delete_btn.onRelease = function() {

	emps_ds.removeItem();

};

PG_8.addEmplyor.save_btn.onRelease = function() {

	emps_ds.applyUpdates();

};

function dsLoaded(ev:Object):Void {

	emps_ds.addSort("nameAscending", ["Employer"]);

	emps_ds.addSort("nameDescending", ["Employer"], DataSetIterator.Descending);

}

emps_ds.addEventListener("afterLoaded", dsLoaded);

function dsPtrChange(ev:Object):Void {

	PG_8.sexRG.selectedData = ev.target.sex;

}

function newSex(ev:Object):Void {

	emps_ds.sex = ev.target.selectedData;

}

emps_ds.addEventListener("iteratorScrolled", dsPtrChange);

PG_8.sexRG.addEventListener("click", newSex);

PG_8.addEmplyor.ascending_btn.onRelease = function() {

	emps_ds.useSort("nameAscending");

};

PG_8.addEmplyor.descending_btn.onRelease = function() {

	emps_ds.useSort("nameDescending", "dept");

};

PG_8.male_btn.onRelease = function() {

	emps_ds.filterFunc = males;

	emps_ds.filtered = true;

};

function males(item:Object):Boolean {

	return item.sex == "M";

}

PG_8.female_btn.onRelease = function() {

	emps_ds.filterFunc = females;

	emps_ds.filtered = true;

};

function females(item:Object):Boolean {

	return item.sex == "F";

}

PG_8.all_btn.onRelease = function() {

	emps_ds.filtered = false;

};

var emps_grd = PG_8.emps_grd;

var getCol = PG_8.emps_grd.getColumnAt;

emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );

var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );

getCol = PG_8.emps_grd.getColumnAt

for ( var i = 0; i < widths.length; i++ ) {

  getCol = parseInt( widths[ i ] );

}

trace( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );
 

// Alter DataGrid dimensions.

/*PG_8.emps_grd.columnNames = ["Employer", "Address", "Phone", "Supervisor", "Contact", "Wage", "Duties", "From", "To", "Reason"];

PG_8.emps_grd.getColumnAt(0).width = 90;

PG_8.emps_grd.getColumnAt(1).width = 100;

PG_8.emps_grd.getColumnAt(2).width = 70;

PG_8.emps_grd.getColumnAt(3).width = 100;

PG_8.emps_grd.getColumnAt(4).width = 50;

PG_8.emps_grd.getColumnAt(5).width = 60;

PG_8.emps_grd.getColumnAt(6).width = 120;

PG_8.emps_grd.getColumnAt(7).width = 50;

PG_8.emps_grd.getColumnAt(8).width = 50;

PG_8.emps_grd.getColumnAt(9).width = 120;*/

PG_8.emps_grd.hScrollPolicy = "on";

PG_8.emps_grd.headerHeight = 30;

PG_8.emps_grd.rowHeight = 60;

PG_8.emps_grd.vScrollPolicy = "auto";

//PG_8.emps_grd.wordWrap="true";

//PG_8.emps_grd.multiline="true";

//import mx.transitions.easing.*;

//_global.styles.ScrollSelectList.setStyle("selectionEasing", Elastic.easeInOut);

//_global.styles.ScrollSelectList.setStyle("selectionDuration", 350);

//_global.styles.ScrollSelectList.setStyle("wordWrap", true);

//_global.styles.ScrollSelectList.setStyle("multiline", true);

_global.styles.ScrollSelectList.setStyle("alternatingRowColors", [0xE9DDBA, 0xffffff]);

_global.styles.ScrollSelectList.setStyle("fontSize", 12);

_global.styles.ScrollSelectList.setStyle("backgroundColor", 0xE9DDBA);

_global.styles.ScrollSelectList.setStyle("rollOverColor", 0xa48e65);

_global.styles.ScrollSelectList.setStyle("selectionColor", 0xffde9d);

_global.styles.ScrollSelectList.setStyle("fontFamily", "Arial");

_global.styles.ScrollSelectList.setStyle("fontWeight", "bold");

_global.styles.ScrollSelectList.setStyle("color", 0x972c25);

_global.styles.ScrollSelectList.setStyle("textRollOverColor", 0x972c25);

_global.styles.ScrollSelectList.setStyle("textSelectedColor", 0x000000);

PG_8.emps_grd.dataProvider = emps_xmlc;

PG_8.emps_grd.iconFunction = function(item) {

	trace(item.data);

	if (item.data == "Employer") {

		return "Employer";

	} else {

		return "fail";

	}

};

trace(emps_xmlc[item.index]);

var listListener:Object = new Object();

listListener.itemRollOver = function(item) {

	time1 = getTimer();

	onEnterFrame = function () {

		if (getTimer()-time1>500) {

			//Build the Word Balloon Text Field

			_root.createEmptyMovieClip("wordBalloon", 1);

			_root.wordBalloon._x = _xmouse-27;

			_root.wordBalloon._y = _ymouse-bTxtH-30;

			_root.wordBalloon.wordBalloonShadow._x = 2;

			_root.wordBalloon.wordBalloonShadow._y = 2;

			_root.wordBalloon.createEmptyMovieClip("wordBalloonGraphic", 10);

			_root.wordBalloon.createEmptyMovieClip("wordBalloonShadow", 5);

			_root.wordBalloon.wordBalloonGraphic.createTextField("balloon_txt", 1, 10, 10, 50, 50);

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.selectable = false;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.html = true;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.autoSize = true;

			//Text Format

			balloonFormat = new TextFormat();

			balloonFormat.font = "Arial";

			balloonFormat.size = 16;

			balloonFormat.color = 0x000000;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.htmlText = "Employer"+item.index+" :"+item.label;

			_root.wordBalloon.wordBalloonGraphic.balloon_txt.setTextFormat(balloonFormat);

			//The Width and Height of the Dynamic Textfield

			bTxtW = _root.wordBalloon.wordBalloonGraphic.balloon_txt._width;

			bTxtH = _root.wordBalloon.wordBalloonGraphic.balloon_txt._height;

			//Build Balloon

			with (_root.wordBalloon.wordBalloonShadow) {

				lineStyle(4, 0x000000, 30);

				moveTo(bTxtW, 0);

				curveTo(bTxtW+20, 0, bTxtW+20, 20);

				lineTo(bTxtW+20, bTxtH);

				curveTo(bTxtW+20, bTxtH+20, bTxtW, bTxtH+20);

				lineTo(30, bTxtH+20);

				lineTo(25, bTxtH+30);

				lineTo(20, bTxtH+20);

				lineTo(20, bTxtH+20);

				curveTo(0, bTxtH+20, 0, bTxtH);

			}

			with (_root.wordBalloon.wordBalloonGraphic) {

				beginFill(0xFFFFCC, 100);

				lineStyle(4, 0x000000, 100);

				moveTo(20, 0);

				lineTo(bTxtW, 0);

				curveTo(bTxtW+20, 0, bTxtW+20, 20);

				lineTo(bTxtW+20, bTxtH);

				curveTo(bTxtW+20, bTxtH+20, bTxtW, bTxtH+20);

				lineTo(30, bTxtH+20);

				lineTo(25, bTxtH+30);

				lineTo(20, bTxtH+20);

				lineTo(20, bTxtH+20);

				curveTo(0, bTxtH+20, 0, bTxtH);

				lineTo(0, 20);

				curveTo(0, 0, 20, 0);

				endFill();

			}

			_root.wordBalloon._visible = true;

		}

	};

};

listListener.itemRollOut = function(item) {

	delete onEnterFrame;

	_root.wordBalloon._visible = false;

};

PG_8.emps_grd.addEventListener("itemRollOver", listListener);

PG_8.emps_grd.addEventListener("itemRollOut", listListener);

////////////////////Context menu

//var my_cm:ContextMenu = new ContextMenu();

//var menuItem_cmi:ContextMenuItem = new ContextMenuItem("Send e-mail", emailHandler);

//my_cm.customItems.push(menuItem_cmi);

//email_mc.menu = my_cm;

//function emailHandler() {

//	trace("sending email");

//}

///ssnop out
 
 

var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"}, {mc:PG_1.urstate, type:"comboBox"}, {mc:PG_1.primphonetype, type:"comboBox"}, {mc:PG_1.altphonetype, type:"comboBox"}, {mc:PG_2.emerg_contype, type:"comboBox"}, {mc:PG_3.days, type:"comboBox"}, {mc:PG_3.evenings, type:"comboBox"}, {mc:PG_3.nights, type:"comboBox"}, {mc:PG_4.high_school_from, type:"Date"}, {mc:PG_4.high_school_to, type:"Date"}, {mc:PG_4.whenHS.high_school_when, type:"Date"}, {mc:PG_2.prevWork.prev_emplofrom, type:"Date"}, {mc:PG_2.prevWork.prev_emploto, type:"Date"}, {mc:PG_7.skill_medterm_date, type:"Date"}, {mc:PG_4.college_from, type:"Date"}, {mc:PG_4.college_to, type:"Date"}, {mc:PG_4.C1_When.college_when, type:"Date"}, {mc:PG_4.college2_from, type:"Date"}, {mc:PG_4.college2_to, type:"Date"}, {mc:PG_4.C2_When.college2_when, type:"Date"}, {mc:PG_5.college3_from, type:"Date"}, {mc:PG_5.college3_to, type:"Date"}, {mc:PG_5.C3_When.college3_when, type:"Date"}, {mc:PG_5.college4_from, type:"Date"}, {mc:PG_5.college4_to, type:"Date"}, {mc:PG_5.C4_When.college4_when, type:"Date"}, {mc:PG_5.crrentEd.current_ed_completdate, type:"Date"}, {mc:PG_6.LENTER.license_xdate, type:"Date"}, {mc:PG_6.LENTER.license2_xdate, type:"Date"}, {mc:PG_9.em_data_rec_brith, type:"Date"}, {mc:PG_1.lastname, type:"textInput"}, {mc:PG_1.firstname, type:"textInput"}, {mc:PG_1.middlename, type:"textInput"}, {mc:PG_1.suffix, type:"textInput"}, {mc:PG_1.ssn, type:"textInput"}, {mc:PG_1.street, type:"textInput"}, {mc:PG_1.city, type:"textInput"}, {mc:PG_1.zip, type:"textInput"}, {mc:PG_1.primphone, type:"textInput"}, {mc:PG_1.altphone, type:"textInput"}, {mc:PG_1.email, type:"textInput"}, {mc:PG_2.emerg_con, type:"textInput"}, {mc:PG_2.emerg_connumber, type:"textInput"}, {mc:PG_2.learnabout_job_othertxt, type:"textInput"}, {mc:PG_2.econ.econtact1.relative_name, type:"textInput"}, {mc:PG_2.econ.econtact1.relative_rela, type:"textInput"}, {mc:PG_2.econ.econtact2.relative_name2, type:"textInput"}, {mc:PG_2.econ.econtact2.relative_rela2, type:"textInput"}, {mc:PG_2.econ.econtact3.relative_name3, type:"textInput"}, {mc:PG_2.econ.econtact3.relative_rela3, type:"textInput"}, {mc:PG_4.high_school_name, type:"textInput"}, {mc:PG_4.high_school_loca, type:"textInput"}, {mc:PG_4.college_name, type:"textInput"}, {mc:PG_4.college_loca, type:"textInput"}, {mc:PG_4.college2_name, type:"textInput"}, {mc:PG_4.college2_loca, type:"textInput"}, {mc:PG_5.college3_name, type:"textInput"}, {mc:PG_5.college3_loca, type:"textInput"}, {mc:PG_5.college4_name, type:"textInput"}, {mc:PG_5.college4_loca, type:"textInput"}, {mc:PG_4.college_major, type:"textInput"}, {mc:PG_4.college2_major, type:"textInput"}, {mc:PG_5.college3_major, type:"textInput"}, {mc:PG_5.college4_major, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_name, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_loca, type:"textInput"}, {mc:PG_5.crrentEd.current_ed_study, type:"textInput"}, {mc:PG_6.LENTER.license_type, type:"textInput"}, {mc:PG_6.LENTER.license_number, type:"textInput"}, {mc:PG_6.LENTER.license_state, type:"textInput"}, {mc:PG_6.LENTER.license2_type, type:"textInput"}, {mc:PG_6.LENTER.license2_number, type:"textInput"}, {mc:PG_6.LENTER.license2_state, type:"textInput"}, {mc:PG_7.skill_typn_wpm, type:"textInput"}, {mc:PG_7.skill_medterm_school, type:"textInput"}, {mc:PG_7.skill_monitors_type, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_1, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_2, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_3, type:"textInput"}, {mc:PG_10.Alt_NAME.leg_othername_4, type:"textInput"}, {mc:PG_10.LEG_Able.leg_able_work_note, type:"textInput"}, {mc:PG_10.LEG_Convic.leg_convic_note, type:"textInput"}, {mc:PG_9.em_data_rec_name, type:"textInput"}, {mc:PG_9.em_data_rec_ssn, type:"textInput"}, {mc:PG_9.em_data_rec_notes, type:"textInput"}, {mc:PG_11.digitalsign, type:"textInput"}, {mc:PG_3.full_time, type:"checkBox"}, {mc:PG_3.part_time, type:"checkBox"}, {mc:PG_3.temp, type:"checkBox"}, {mc:PG_3.on_call, type:"checkBox"}, {mc:PG_3.avaiable_mon, type:"checkBox"}, {mc:PG_3.avaiable_tus, type:"checkBox"}, {mc:PG_3.avaiable_wed, type:"checkBox"}, {mc:PG_3.avaiable_thru, type:"checkBox"}, {mc:PG_3.avaiable_fri, type:"checkBox"}, {mc:PG_3.avaiable_sat, type:"checkBox"}, {mc:PG_3.avaiable_sun, type:"checkBox"}, {mc:PG_1.ssnoptout, type:"checkBox"}, {mc:PG_2.learnabout_job_ad, type:"checkBox"}, {mc:PG_2.learnabout_job_friend, type:"checkBox"}, {mc:PG_2.learnabout_job_other, type:"checkBox"}, {mc:PG_7.skill_typn, type:"checkBox"}, {mc:PG_7.skill_dataentry, type:"checkBox"}, {mc:PG_7.skill_medterm, type:"checkBox"}, {mc:PG_7.skill_medtrans, type:"checkBox"}, {mc:PG_7.skill_accounting, type:"checkBox"}, {mc:PG_7.skill_insure_bill, type:"checkBox"}, {mc:PG_7.skill_credit_collect, type:"checkBox"}, {mc:PG_7.skill_switchborad, type:"checkBox"}, {mc:PG_7.skill_cashier, type:"checkBox"}, {mc:PG_7.skill_10key, type:"checkBox"}, {mc:PG_7.skill_invoicing, type:"checkBox"}, {mc:PG_7.skill_reception, type:"checkBox"}, {mc:PG_7.skill_floorcare_man, type:"checkBox"}, {mc:PG_7.skill_floorcare_mac, type:"checkBox"}, {mc:PG_7.skill_dishman, type:"checkBox"}, {mc:PG_7.skill_dishindus, type:"checkBox"}, {mc:PG_7.skill_linen, type:"checkBox"}, {mc:PG_7.skill_sterilizer, type:"checkBox"}, {mc:PG_7.skill_autoclave, type:"checkBox"}, {mc:PG_7.skill_sewing, type:"checkBox"}, {mc:PG_7.skill_maintengen, type:"checkBox"}, {mc:PG_7.skill_maintencraft, type:"checkBox"}, {mc:PG_7.skill_maintencraft_el, type:"checkBox"}, {mc:PG_7.skill_maintencraft_pl, type:"checkBox"}, {mc:PG_7.skill_maintencraft_co, type:"checkBox"}, {mc:PG_7.skill_maintencraft_pt, type:"checkBox"}, {mc:PG_7.skill_steriletechique, type:"checkBox"}, {mc:PG_7.skill_vitalsigns, type:"checkBox"}, {mc:PG_7.skill_charting, type:"checkBox"}, {mc:PG_7.skill_pre_opprep, type:"checkBox"}, {mc:PG_7.skill_isolation, type:"checkBox"}, {mc:PG_7.skill_cateterization, type:"checkBox"}, {mc:PG_7.skill_coronarycare, type:"checkBox"}, {mc:PG_7.skill_intensive, type:"checkBox"}, {mc:PG_7.skill_monitors, type:"checkBox"}, {mc:PG_7.skill_orthopedic, type:"checkBox"}, {mc:PG_7.skill_pediatic, type:"checkBox"}, {mc:PG_7.skill_obstertrics, type:"checkBox"}, {mc:PG_7.skill_medical, type:"checkBox"}, {mc:PG_7.skill_surgical, type:"checkBox"}, {mc:PG_7.skill_geriatric, type:"checkBox"}, {mc:PG_7.skill_oncology, type:"checkBox"}, {mc:PG_7.skill_family_homecare, type:"checkBox"}, {mc:PG_9.em_data_rec_w, type:"checkBox"}, {mc:PG_9.em_data_rec_b, type:"checkBox"}, {mc:PG_9.em_data_rec_h, type:"checkBox"}, {mc:PG_9.em_data_rec_a, type:"checkBox"}, {mc:PG_9.em_data_rec_a_i, type:"checkBox"}, {mc:PG_9.em_data_rec_v, type:"checkBox"}, {mc:PG_9.em_data_rec_d, type:"checkBox"}, {mc:PG_9.em_data_rec_di, type:"checkBox"}, {mc:PG_leg.appstate_cb, type:"checkBox"}, {mc:PG_leg.drugtest, type:"checkBox"}, {mc:PG_11.digital_agree, type:"checkBox"}, {chkYes:PG_8.addEmplyor.Em_HIS_Con_Y, chkNo:PG_8.addEmplyor.Em_HIS_Con_N, type:"checkBoxYN"}, {chkYes:PG_3.rotate_shifts_Y, chkNo:PG_3.rotate_shifts_N, type:"checkBoxYN"}, {chkYes:PG_3.weekends_Y, chkNo:PG_3.weekends_N, type:"checkBoxYN"}, {chkYes:PG_2.relativeemplo_Y, option:PG_2.econ, optionVal:51.8, chkNo:PG_2.relativeemplo_N, type:"checkBoxYN"}, {chkYes:PG_4.high_school_did_atend_Y, option:PG_4.whenHS, optionVal:396.1, chkNo:PG_4.high_school_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_4.college_did_atend_Y, option:PG_4.C1_When, optionVal:395.3, chkNo:PG_4.college_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_4.college2_did_atend_Y, option:PG_4.C2_When, optionVal:395.3, chkNo:PG_4.college2_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.college3_did_atend_Y, option:PG_5.C3_When, optionVal:395.3, chkNo:PG_5.college3_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.college4_did_atend_Y, option:PG_5.C4_When, optionVal:395.3, chkNo:PG_5.college4_did_atend_N, type:"checkBoxYN"}, {chkYes:PG_5.current_ed_Y, option:PG_5.crrentEd, optionVal:25, chkNo:PG_5.current_ed_N, type:"checkBoxYN"}, {chkYes:PG_6.licensed_Y, option:PG_6.LENTER, optionVal:45.0, chkNo:PG_6.licensed_N, type:"checkBoxYN"}, {chkYes:PG_6.LApplied.app4license_Y, option:PG_6.LApplied, optionVal:57.0, chkNo:PG_6.LApplied.app4license_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_othername_Y, option:PG_10.Alt_NAME, optionVal:100.8, chkNo:PG_10.leg_othername_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_able_work_Y, chkNo:PG_10.leg_able_work_N, type:"checkBoxYN"}, {chkYes:PG_10.leg_visa_Y, chkNo:PG_10.leg_visa_N, type:"checkBoxYN"}, {chkYes:PG_9.em_data_rec_sex_F, chkNo:PG_9.em_data_rec_sex_M, type:"checkBoxYN"}, {chkYes:PG_10.leg_convic_Y, chkNo:PG_10.leg_convic_N, type:"checkBoxYN"}, {chkYes:PG_2._18_Y, chkNo:PG_2._18_N, type:"checkBoxYN"}, {chkYes:PG_2.prev_emplo_Y, chkNo:PG_2.prev_emplo_N, option:PG_2.prevWork, optionVal:230.7, type:"checkBoxYN"});
 

for (var i = 0; i<fieldArray.length; i++) {

	fieldArray[i].option._x = 2000;

	switch (fieldArray[i].type) {

		case "textInput" :

			fieldArray[i].mc.addEventListener("change",onSelect_text);

			break;

		case "checkBox" :

			fieldArray[i].mc.addEventListener("click",onSelected);

			fieldArray[i].option._x = 2000;

			break;

		case "checkBoxYN" :

			fieldArray[i].chkYes.addEventListener("click",checkBoxListener);

			fieldArray[i].chkNo.addEventListener("click",checkBoxListener);
 

			break;

		case "comboBox" :

			fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

			break;

		case "Date" :

			fieldArray[i].mc.addEventListener("change",onSelect_Date);

			break;

		case "YES_NO" :

			fieldArray[i].mc.addEventListener("click",onSelectedPath);

			break;

	}

}
 

import flash.external.ExternalInterface;

function getTextFromJavaScript(str:String):Void {

	ObjectToPass = "From JavaScript: "+str;

	///need to add: get input id suffix

}

ExternalInterface.addCallback("sendTextToFlash",this,getTextFromJavaScript);
 

//and one to catch what comes back
 

dataSender = new LoadVars();

dataReceiver = new LoadVars();

dataReceiver.onLoad = function() {

	if (this.response == "invalid") {

		alert_txt.text = "Please check from.invalid";

	} else if (this.response == "error") {

		alert_txt.text = "Please check from.error";

	} else if (this.response == null) {

		alert_txt.text = "The server is haveing issues.";

	} else if (this.response == "passed") {

		alert_txt.text = "Submission completed.";

		ExternalInterface.call("formSubmit");

	}

};
 
 

function clickSend(eventObj:Object):Void {

	var jsArgument:String = outPutArray;

	var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

	ObjectToPass = "m7feu_input_"+result;

	trace("sent");

}

function phpSend(eventObj:Object):Void {

//	var jsArgument:String = complete_outPutArray;

//	var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);

//	ObjectToPass = "m7feu_input_"+result;

	trace("sent");

}

onEnterFrame(load);

{

	var FullArray:String = "{name:value}";

	//_global.FullArray = new Array();

	_global.complete_outPutArray = new Array();

	_global.outPutArray = new Array();

	_global.testIfSelected = function(t) {

		for (i=0; i<complete_outPutArray.length; i++) {

			if (complete_outPutArray[i] == t) {

				return i;

			}

		}

		return -1;

	};

};
 
 

////job

var JOBdgListener:Object = new Object();

JOBdgListener.change = function(evt_obj:Object) {

onSelect_list(evt_obj);

};

// Add listener.

Starts.jobs_picks.addEventListener("change",JOBdgListener);
 

function onSelect_list(evt_obj) {

	trace("The selection has changed to "+evt_obj.target.selectedIndex);

	trace("Selected items: "+evt_obj.target.selectedItems);

	var s:String = "";

	var myObjArray:Array = evt_obj.target.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(evt_obj.target._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

}
 
 
 
 
 
 

/// List components /data grid

function onSelect_emps(evt_obj) {

PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	FullArray = FullArray+",{"+outPutArray+"}";

	trace(outPutArray);

	clickSend();

}
 
 
 

var dgListener:Object = new Object();

dgListener.change = function(evt_obj:Object) {

onSelect_emps(evt_obj);

	

};

PG_8.emps_grd.addEventListener("change",dgListener);
 

DGlistenerObject = new Object();

DGlistenerObject.cellFocusOut = function(eventObject) {

	onSelect_emps(evt_obj);

};

PG_8.emps_grd.addEventListener("cellFocusOut",DGlistenerObject);

DGlistenerObject.cellFocusIn = function(eventObject) {

	onSelect_emps(evt_obj);

};

PG_8.emps_grd.addEventListener("cellFocusIn",DGlistenerObject);
 
 

////date

function onSelect_Date() {

	trace(this._name);

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedDate);

	}

	trace(outPutArray);

	clickSend();

}

/// comobo box 

function onSelect_cbItemPicked() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.selectedItem.data);

	}

	trace(outPutArray);

	clickSend();

}
 

/// TextInput 

function onSelect_text() {

	var pos = testIfSelected(this._name);

	outPutArray.splice(pos,1);

	if (pos == -1) {

		outPutArray.push(this._name+":"+this.text);

	}

	trace(outPutArray);

	clickSend();

}
 
 
 

////for single cb

function onSelected(checkbox) {

	var pos = testIfSelected(this._name);

	if (this.selected == true) {

		fieldArray[i].option._x = fieldArray[i].optionVal;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+":"+this.label);

		}

		trace(outPutArray);

	} else if (this.selected == false) {

		fieldArray[i].option._x = 2000;

		outPutArray.splice(pos,1);

		if (pos == -1) {

			outPutArray.push(this._name+": ");

		}

		trace(outPutArray);

	} else {

		fieldArray[i].option._x = 2000;

		if (pos>=0) {

			outPutArray.splice(pos,1);

		}

		trace(outPutArray);

	}

	clickSend();

}

PG_1.ssnMask._x = 2000;

PG_1.N1._x = 2000;

function onSelectAPP_SSNoptOUT(checkbox) {

	if (PG_1.ssnoptout.selected == true) {

		PG_1.ssn.text = "";

		PG_1.ssn.enabled = false;

		PG_1.ssn.maxChars = 0;

		PG_1.ssnMask._x = 42.9;

		PG_1.N1._x = 249;

	} else {

		PG_1.ssnMask._x = 2000;

		PG_1.N1._x = 2000;

		PG_1.ssn.enabled = true;

		PG_1.ssn.maxChars = 9;

		PG_1.ssn.text = "";

	}

}

PG_1.ssnoptout.addEventListener("click",onSelectAPP_SSNoptOUT);

///Learn about job

PG_2.learnabout_job_othertxt._x = 2000;

function onSelectLearnAbout_Other(checkbox) {

	if (PG_2.learnabout_job_other.selected == true) {

		PG_2.learnabout_job_othertxt.text = "";

		PG_2.learnabout_job_othertxt._x = 277.2;

	} else {

		PG_2.learnabout_job_othertxt._x = 2000;

		PG_2.learnabout_job_othertxt.text = "";

	}

}

PG_2.learnabout_job_other.addEventListener("click", onSelectLearnAbout_Other);
 
 
 
 

function checkBoxListener(evt) {

	for (i=0; i<fieldArray.length; i++) {

		if (fieldArray[i].optionFunc == "true") {

			runFuntionSwitch(fieldArray[i].optionFuncName);

		}

		if (fieldArray[i].chkYes == evt.target) {

			trace("event traget chkYes rechaced");

			if (fieldArray[i].chkYes.selected=true) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = fieldArray[i].optionVal;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Yes");

				}

				trace(outPutArray);

				trace(evt.target._name+":Yes");

				clickSend();

			} else if (fieldArray[i].chkYes.selected=false) {

				fieldArray[i].chkNo.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else if (fieldArray[i].chkNo == evt.target) {

			trace("event traget chkNo rechaced");

			if (fieldArray[i].chkNo.selected=true) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":No");

				}

				trace(evt.target._name+":No");

				trace(outPutArray);

				clickSend();

			} else if (fieldArray[i].chkNo.selected=false) {

				fieldArray[i].chkYes.selected = false;

				fieldArray[i].option._name._x = 2000;

				outPutArray.splice(pos,1);

				if (pos == -1) {

					outPutArray.push(evt.target._name+":Na");

				}

				trace(outPutArray);

				trace(evt.target._name+":Na");

				clickSend();

			}

		} else {

			trace("checking.... not it");

		}

	}

}
 
 
 
 
 
 
 
 
 

function submitTo() {

	var FullArray:String = "{name:value}";

	var myDate:Date = new Date();

	FullArray = FullArray+",{Applacation Date:"+myDate+"}";

	PG_8.emps_grd.multipleSelection = true;

	PG_8.emps_grd.selectedIndices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

	var s:String = "";

	var myObjArray:Array = PG_8.emps_grd.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{row|"+i+",employer|"+myObjArray[i].Employer+",address|"+myObjArray[i].Address+",phone|"+myObjArray[i].Phone+",supervisor|"+myObjArray[i].Supervisor+",contact|"+myObjArray[i].Contact+",wage|"+myObjArray[i].Wage+",duties|"+myObjArray[i].Duties+",from|"+myObjArray[i].From+",to|"+myObjArray[i].To+",reason|"+myObjArray[i].Reason+"}";

	var pos = testIfSelected(this._name);

	complete_outPutArray.splice(pos,1);

	if (pos == -1) {

		complete_outPutArray.push(PG_8.emps_grd._name+":"+s);

	}

	FullArray = FullArray+",{"+complete_outPutArray+"}";

	trace(complete_outPutArray);

	phpSend();

	

	var s:String = "";

	var myObjArray:Array = Starts.jobs_picks.selectedItems;

	var i = 0;

	for (i=0; i<myObjArray.length-1; i++) {

		s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"},";

	}

	// add the last one without a comma on the end

	i = myObjArray.length-1;

	s = s+"{Job_Pick`"+i+"|"+myObjArray[i].label+"}";
 

	// assuming all three lines are selected (Clark,Bruce,Peter)

	trace(s);// outputs "row1,Clark,3135,row2,Bruce,403,row3,Peter,25"
 

	var pos = testIfSelected(this._name);

	complete_outPutArray.splice(pos,1);

	if (pos == -1) {

		complete_outPutArray.push(Starts.jobs_picks._name+":"+s);

	}

	FullArray = FullArray+",{"+complete_outPutArray+"}";

	trace(complete_outPutArray);

	phpSend();

	

	for (var i = 0; i<fieldArray.length; i++) {

		

		switch (fieldArray[i].type) {

			case "textInput" :

				fieldArray[i].mc.addEventListener("change",onSelect_text);

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.text);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "checkBox" :

				fieldArray[i].mc.addEventListener("click",onSelected);

				var pos = testIfSelected(this._name);

				if (fieldArray[i].mc.selected == true) {

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.label);

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				} else if (fieldArray[i].mc.selected == false) {

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].mc._name+":");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				} else {

					if (pos>=0) {

						complete_outPutArray.splice(pos,1);

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

				}

				phpSend();

				break;

			case "comboBox" :

				fieldArray[i].mc.addEventListener("change",onSelect_cbItemPicked);

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedItem.data);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "Date" :

				fieldArray[i].mc.addEventListener("change",onSelect_Date);
 

				var pos = testIfSelected(this._name);

				complete_outPutArray.splice(pos,1);

				if (pos == -1) {

					complete_outPutArray.push(fieldArray[i].mc._name+":"+fieldArray[i].mc.selectedDate);

				}

				FullArray = FullArray+",{"+complete_outPutArray+"}";

				trace(complete_outPutArray);

				phpSend();

				break;

			case "checkBoxYN" :

				fieldArray[i].chkYes.addEventListener("click",checkBoxListener);

				fieldArray[i].chkNo.addEventListener("click",checkBoxListener);

				if (fieldArray[i].chkYes.selected == true) {

					var pos = testIfSelected(fieldArray[i].chkYes._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkYes._name+":"+"Yes");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(complete_outPutArray);

					//trace(fieldArray[i].chkYes._name+":Yes");

					phpSend();

				} else if (fieldArray[i].chkNo.selected == true) {

					var pos = testIfSelected(fieldArray[i].chkNo._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkNo._name+":"+"No");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					//trace(fieldArray[i].chkNo._name+":No");

					trace(complete_outPutArray);

					phpSend();

				} else {

					var pos = testIfSelected(fieldArray[i].chkNo._name);

					complete_outPutArray.splice(pos,1);

					if (pos == -1) {

						complete_outPutArray.push(fieldArray[i].chkNo._name+":"+"");

					}

					FullArray = FullArray+",{"+complete_outPutArray+"}";

					trace(fieldArray[i].chkNo._name+":"+"");

				}

				break;

		}

		

	}

	trace(FullArray);
 

}
 
 
 
 
 
 
 
 
 
 
 
 

//////////////////

/// on submit

//////////////////

Bar.Send.onRelease = function() {

	submitTo();

	var postVars:LoadVars = new LoadVars();

	postVars.dataArray = FullArray;

	postVars.sendAndLoad("../Core_files/PDFgenerator/tcpdf_php4/examples/example_011.php",dataReceiver,"POST");

};

Open in new window

0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21845141
I will look at this after I attend some meetings.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21854666
ok, here's what's happening...

In lines 127.. 135, you:


 Line| Comment

-----+--------------------------------------------------

 128 | declare/define getCol as an alias for PG_8.emps_grd.getColumnAt

 131 | redefine getCol as an alias for PG_8.emps_grd.getColumnAt

 133 | discard the alias, and loop through all of the column #

 135 | After processing all of the column #'s getCol will have the last

     | number referenced... (i.e., 120)

Open in new window

0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21854673
What are you trying to do with this code?
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21858397
Um are you meaning what does the code do? or why I'm I trying to work it?.... The why I'm working the code is ... well in the end I want to have the form were I can Just place a component down on the stage and have it output-ble... thats why I have been try too ask about and googlen anything on having the AS read items on the fly off the stage....

This post here is trying to go over that....
http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23466470.html

this would knock out most of
var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"}, {mc:PG_1.urstate, type:"comboBox"}, ...etc....

Which would save another~8-9kb if the phraser that would form this array was not to big...


Also I'm try to lower the file size as well.... It is sitting at 177kb at this point, not bad in the sense that I knocked off ~15kb doing the first round of refactoring.... but I need to go lower... I was hope to hit 100kb... (a high goal but I'm determined) :)

The thing is that the form changes, so I will be have the flash form build it is self dynamically... I'm getting all the pieces in place for that... I'm open to any ideas... thanks for the help on this...
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21858508
What are you trying to do (in this piece of code)?

I can figure out what the code is actually doing... I've been reading code (of one sort or another) for > 35 years.  :-)

0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21859072
Sorry I was not meaning to be rude... I thought you knew but I've run into a lot of people that have made suggestions with out even knowing what the code was doing... that was fun lol.... so I ask so Im not ass-u-me-ing anything :-)


What are you trying to do (in this piece of code)?
////////////////////////////
well to eliminate the bulk of this would be good:
var fieldArray = new Array({mc:PG_1.name_title, type:"comboBox"}, {mc:PG_1.urstate, type:"comboBox"}, ...etc....

I'm try to lower the file size.... currently 177kb at this point.... but I need to go lower... I was hope to hit 100kb... (a high goal but I'm determined) :)-

The thing is that the form changes, so I will be have the flash form build it is self dynamically... so if i could read the stage then I can kill to birds with one stone... at least that is the thought here... and get I'm open to any ideas... I'm just looking for better ways to write this but get the same output...

there are other posts here that are related to this....
 
this is on the posting of the flash data to the php
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23477927.html

this is on trying to find a good way to read the components on the stage(have not gotten very far on this)
http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23466470.html

This is about the submitting process... (i solved this but will change to what ever fits the big solution)
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23486172.html


I think this is all the stuff that is not already in the code you see... I've been working hard at this... Talked with a lot of people to learn the best ways to do this... well thanks for the help on this...
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21859520
I understand completely.  I too am sometime hard pressed, and don't take the time
and effort to completely understand what is going on.  I frequently "fire and forget",
sometime with embarrassing  results.  :-)

What I should have said, was...

embarrassing  

What are you trying to do in this piece of code (i.e., lines 128 - 135)?

I "think" that you are trying to do what I suggested earlier

http://www.experts-exchange.com/Q_23486958.html#a21792487

If so, you didn't paste the code properly.
var emps_grd = PG_8.emps_grd;

var getCol = PG_8.emps_grd.getColumnAt;

emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );

var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );

getCol = PG_8.emps_grd.getColumnAt

for ( var i = 0; i < widths.length; i++ ) {

  getCol = parseInt( widths[ i ] );

}

trace( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );

Open in new window

0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 41

Expert Comment

by:HonorGod
ID: 21859563
What I was suggesting with the code was to:

create an alias for PG_8.emps_grd.getColumnAt
using:

var getCol = PG_8.emps_grd.getColumnAt;

This creates a variable named getCol which is a "reference to another function"
(i.e., an alias).  Then, instead of having your code say:

PG_8.emps_grd.getColumnAt(0).width = 90;

the alias allows you to replace this statement with:

getCol( 0 ).width = 90;
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21859635
LOL at least it anit a client ... I did that once 10 or 11 years ago... just a slip-up and boom lost the whole account... and it was just a missunderstanding... :-) that was fun lol...

"What are you trying to do in this piece of code (i.e., lines 128 - 135)?
I "think" that you are trying to do what I suggested earlier"

Yes...yes... that is the case... but I tryed C/P it may times...  all i get for the trace is

getCol: number
getColumnAt: function
 are identical: false

I tired to de bug it... but no luck....
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21859786
but the code that you show above, specifically line 133 is:

getCol = parseInt( widths[ i ] );

instead of:

getCol( i ) = parseInt( widths[ i ] );

does this make sense?
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21859975
Yes most certainly, but I keep getting

Line 133: Left side of assignment operator must be variable or property.
       getCol( i ) = parseInt( widths[ i ] );
as an error... that was why the change... It was my "attempt" at fixing it so it works.... lol

Side note... I don't think i said this, but I'm working with flash 8 AS 2
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21860909
Ah ha!

It should be:

getCol( i ).width = parseInt( widths[ i ] );

Please forgive me.
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21868659
Why forgive ... your helping... even this stuff helps... anyways,

getCol: function
getColumnAt: function
 are identical: true

that looks good but i cheacked the dataGrid and no change in width... a little lost there....

doesn't
emps_grd.columnNames have to relate to getCol or widths?  doesn't seem to~?
var emps_grd = PG_8.emps_grd;

var getCol = PG_8.emps_grd.getColumnAt;

emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );

var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );

getCol = PG_8.emps_grd.getColumnAt

for ( var i = 0; i < widths.length; i++ ) {

  getCol( i ).width = parseInt( widths[ i ] );

}

trace( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );

Open in new window

0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21868887
Note that line 5, i.e.,

getCol = PG_8.emps_grd.getColumnAt

is redundant, and unnecessary.  It is, basically, identical to line 2:

var getCol = PG_8.emps_grd.getColumnAt;

and replaces the value (which is reference to a function) with the identical value (i.e., a copy of the reference to the same function).

So, later, in line 7, when we see:

getCol( i ).width

The result of the function "getCol( i )" should be an object reference, which is
used to identify the object attribute (i.e., the width attribute) whose value is
to be assigned to the integer value result of:

parseInt( widths[ i ] )

Does this make sense?
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21869104
mostly, ~i think~ so the problem lays in that the getCol( i )? because... it's not being reference as an object?


for ( var i = 0; i < widths.length; i++ ) {
  getCol( i ).width = parseInt( widths[ i ] );
  trace (parseInt( widths[ i ] ));
  trace (getCol( i ));
}
as it traces

90
undefined
100
undefined
70
undefined
100
undefined
50
undefined
60
undefined
120
undefined
50
undefined
50
undefined
120
undefined
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21869168
ooh... that's interesting.

Does this result in true?

trace( getCol === PG_8.emps_grd.getColumnAt )

0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21869678
yeah it's true... it seems that I like to find puzzles...
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21869769
So what in the world is this beast?

PG_8.emps_grd.getColumnAt

I understand it is a function, I just don't know what the function code looks like.
Please locate the assignment to PG_8 and find out what kind of object reference
is assigned to this variable.  And look for the emps_grd object, and finally the
getColumnAt function.

Can you share that code?
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21869883
All the code is here
http://www.experts-exchange.com/Q_23486958.html#a21842896
I didn't leave anything out, PG_8 is only a mc... so PG_8.emps_grd is the location(mc) and datagrid... do i need to add something?  I'm getting lost on what is causing this to happen.. the last time I had this kind of issue it was due to object verses a string issue... but it doesn't look like that ~~~? lol
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21869994
What is "mc"?

What does this "PG_8 is only a mc" mean?

Please forgive my lack of knowledge.
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21870060
it's a movie clip....  
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21870134
Unfortunately, that is not something with which I am familiar.

what do you get with:

trace( 'i: ' + i + ' identical? ' + ( getCol( i ) === PG_8.emps_grd.getColumnAt( i ) )
0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21870253
i: 10 identical? true


:-)
0
 
LVL 41

Accepted Solution

by:
HonorGod earned 500 total points
ID: 21870980
Which makes no sense...

How can

getCol( i ) be identical to PG_8.emps_grd.getColumnAt( i )

yet

getCol( i ) be undefined, as your update here shows?

http://www.experts-exchange.com/Q_23486958.html#a21869104

ok, please replace the loop (as shown in that update) with the following...
for ( var i = 0; i < widths.length; i++ ) {

  trace( 'before: i = ' + i + ' = ' + widths[ i ] )

  getCol( i ).width = parseInt( widths[ i ] );

  trace( 'after: ' + getCol( i ).width );

}

Open in new window

0
 
LVL 4

Author Comment

by:jeremyBass26
ID: 21871212
well that puts out...

before: i = 0 = 90
after: undefined
before: i = 1 = 100
after: undefined
before: i = 2 = 70
after: undefined
before: i = 3 = 100
after: undefined
before: i = 4 = 50
after: undefined
before: i = 5 = 60
after: undefined
before: i = 6 = 120
after: undefined
before: i = 7 = 50
after: undefined
before: i = 8 = 50
after: undefined
before: i = 9 = 120
after: undefined
getCol: function
getColumnAt: function
 are identical: true
true
i: 10 identical? true


this is the current....
var emps_grd = PG_8.emps_grd;

var getCol = PG_8.emps_grd.getColumnAt;

emps_grd.columnNames = "Employer,Address,Phone,Supervisor,Contact,Wage,Duties,From,To,Reason".split( ',' );

var widths = '90,100,70,100,50,60,120,50,50,120'.split( ',' );

getCol = PG_8.emps_grd.getColumnAt

/*for ( var i = 0; i < widths.length; i++ ) {

  getCol( i ).width = parseInt( widths[ i ] );

  trace (parseInt( widths[ i ] ));

  trace (getCol( i ));

}*/

for ( var i = 0; i < widths.length; i++ ) {

  trace( 'before: i = ' + i + ' = ' + widths[ i ] )

  getCol( i ).width = parseInt( widths[ i ] );

  trace( 'after: ' + getCol( i ).width );

}
 

trace( 'getCol: ' + typeof( getCol ) + '\ngetColumnAt: ' + typeof( PG_8.emps_grd.getColumnAt ) + '\n are identical: ' + ( getCol === PG_8.emps_grd.getColumnAt ) );

trace( getCol === PG_8.emps_grd.getColumnAt )

trace( 'i: ' + i + ' identical? ' + ( getCol( i ) === PG_8.emps_grd.getColumnAt( i ) ))

Open in new window

0
 
LVL 4

Author Closing Comment

by:jeremyBass26
ID: 31467451
Hey this is more of a solutionless answer but thats ok is was a solutionless question in a sense... Look for part two....  at http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23525662.html

thanks for the help
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21917804
Thanks for the grade & points.

I'm glad that you found my updates useful

Good luck & have a great day
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now