jsfl自运行与被调运行

/**
 * package/demo_Init
 */

/*函数雏形 一定要顶置*/
var demo_included = {};

//需要导入的类包名称
var demo_class_arr = [];

//当前路径
var demo_URI = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf("/"));
//父级路径
var demo_parentURI = demo_URI.substr(0,demo_URI.lastIndexOf("/") + 1);
var main_good;

function demo_Init(demoCallBack, _doc, _data){
	
	fl.trace("demo_Init "+main_good)
	//demo_common(_doc);
	//if(demoCallBack)
	//demoCallBack.call(null,_doc,_data);
}

function demo_common(_doc){
	
}


demo_Init();



/*******************************导入方法**************************************************/

/**
 * 导入类包
 * @param	file  包名 不含后缀
 */
function demo_includeFile(file) {
     if (demo_included[file]) { return; }
     demo_included[file] = true;
     fl.runScript(demo_parentURI +file + ".jsfl");
}

/**
 * 导入类包
 */
function demo_startImport(){
	for (var i in demo_class_arr) {
		demo_includeFile(demo_class_arr[i]);
	}
}

  

fl.outputPanel.clear();

//完整路径带文件名 如;abc/abc.jsfl
var root_Wholeurl = fl.scriptURI;
//jsfl名称带后缀 如;abc.jsfl
var root_name = fl.scriptURI.substr(fl.scriptURI.lastIndexOf("/") + 1);
//不带文件名路径但带斜杠 如:abc/
var root_Url = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf("/") + 1);


/*函数雏形 一定要顶置*/
var included = {};

//需要导入的类包名称
var class_arr=["package/demo"];

var main_good=true;
init();

function init(){
	startImport();
//	demo_Init();
	//fl.trace(SelectData.prototype.get_item_by_flag(fl.getDocumentDOM(), "ab"));
	////fl.trace(SelectData.prototype.get_item_by_link(fl.getDocumentDOM(), "ab"));
	////fl.trace(Stage.prototype.GetBGColor(fl.getDocumentDOM()));
	//Stage.prototype.SetBGColor(fl.getDocumentDOM(), "#000000");
	//fl.trace(Stage.prototype.GetStageSize(fl.getDocumentDOM()));
	//Stage.prototype.SetStageSize(fl.getDocumentDOM(),400,500);
	//fl.trace(Stage.prototype.GetFrameRate(fl.getDocumentDOM()));
	//Stage.prototype.SetFrameRate(fl.getDocumentDOM(),50)
	////Stage.prototype.CloseFla(fl.getDocumentDOM(),true);
	////fl.trace(Stage.prototype.is_url("c:\b"));
	//fl.trace(Stage.prototype.to_path("b"));
	
	
}




/*******************************导入方法**************************************************/

/**
 * 导入类包
 * @param	file  包名 不含后缀
 */
function includeFile(file) {
     if (included[file]) { return; }
     included[file] = true;
     fl.runScript(root_Url +file + ".jsfl");
}

/**
 * 导入类包
 */
function startImport(){
	for (var i in class_arr) {
		includeFile(class_arr[i]);
	}
}

  

原文地址:https://www.cnblogs.com/dt1991/p/10956309.html