#include "as_functions/string_utils.as"
#include "as_functions/movieclip_utils.as"
#include "as_functions/tween_utils.as"
movieActions = function (scope, container) {
this.container = container;
trace("this.container._alpha: "+this.container._alpha);
this.scope=scope;
_global.ref=this;
this.init();
};
movieActions.prototype = new Object();
movieActions.prototype.init = function() {
trace("init called");
trace("the scope is: "+this.scope);
this.boxLoader = this.scope.createEmptyMovieClip("boxLoader_mc", 1);
this.boxLoader._alpha=0;
//required width and height
this.boxWidth = this.scope._width;
this.boxHeight = this.scope._height;
// total line length
this.boxLength = (this.boxWidth*2) + (this.boxHeight*2);
};
movieActions.prototype.loadContent = function(path, delay, cache, postArray) {
if(path!=undefined && path.indexOf(".swf") != -1) {
trace("correct arguments");
if(typeof path !="string"){
trace("patnot string so converting");
var path=path.toString();//reassign path
}
path = path.trim();//remove excess
if(typeof cache !="string"){
if(cache==false){
path += "?id="+Math.round(Math.random()*10000);
}
}else{
if(cache.trim() == "false" || cache.trim() == "0"){
trace("no cache teeteced");
path += "?id="+Math.round(Math.random()*10000);
}
}
var delay=0;
if(delay!=undefined){
switch(typeof (delay)){
case "string":
//must be a string, convert to number and assign
delay=parseInt(delay.trim());
break;
case "number":
//must be a number so assign delay
trace("delay of "+delay+" secs specified");
delay=delay;
break;
default:
//dont know what type it is so go to default
delay=0;
break;
}
}
//Append any POST vars
if (postArray instanceof Array && postArray.length>0) {
trace("appending POST vars");
var tmpArray = new Array(postArray.length);
for (var i = 0; i<postArray.length; i++) {
if (postArray* != undefined) {
tmpArray* = "var"+(i)+"="+escape(postArray*.trim());
}
//url encode value
}
var queryString = tmpArray.join("&");
// add '&' to seperate name=value pairs
delete postArray;
delete tmpArray;
path+= (path.indexOf("?") == -1) ? "?"+queryString : "&"+queryString;
}
ref.updateContent(path, delay);
} else {
trace("Error loadContent: no file to load");
}
};
movieActions.prototype.loadNext = function(path) {
trace("loadNext: "+path+", "+this.container);
trace("loader "+this.loader);
//remove current
unloadMovie(ref.container);
//show preloader
ref.boxLoader.alphaTo(100, 0, "linear", 0, undefined);
//this.loader.label_txt._visible=true;
//begin loading
loadMovie(path, ref.container);
//show preloading status
ref.loadComplete = setInterval(ref, "showLoading", 40);
};
movieActions.prototype.updateContent = function(path, delay) {
trace("updateContent "+this.container);
//destAlpha, seconds, animType, delay, callback, extra1, extra2
//fade out current, and then wait for given delay before load next
this.container.alphaTo(0, 1, "linear", delay, {scope:this, func:this.loadNext, args:[path]});
};
movieActions.prototype.showLoading = function() {
trace("showLoading "+this.container+" "+this.boxLoader);
this.boxLoader.clear();
this.boxLoader.lineStyle(1, 0xDCE292, 100);
if (this.container.getBytesTotal() > 100){
// percent of movie loaded
pct = Math.round((100/this.container.getBytesTotal()) * this.container.getBytesLoaded());
} else {
pct = 0;
}
// find the length of the line to draw from this.pct loaded
lineSize = (this.boxLength*pct)/100;
this.boxLoader.moveTo(0, 0);
// line one
if (lineSize<this.boxWidth) {
this.boxLoader.lineTo(lineSize, 0);
} else {
this.boxLoader.lineTo(this.boxWidth, 0);
// line two
if (lineSize<this.boxWidth+this.boxHeight) {
this.boxLoader.lineTo(this.boxWidth, lineSize-this.boxWidth);
} else {
this.boxLoader.lineTo(this.boxWidth, this.boxHeight);
// line three
if (lineSize<(this.boxWidth*2)+this.boxHeight) {
this.boxLoader.lineTo(((this.boxWidth*2)+this.boxHeight)-lineSize, this.boxHeight);
} else {
this.boxLoader.lineTo(0, this.boxHeight);
// line four
if (lineSize<this.boxLength) {
this.boxLoader.lineTo(0, this.boxLength-lineSize);
} else {
this.boxLoader.lineTo(0, 0);
}
}
}
}
if (pct == 100) {
trace("loadCompleted");
//delete this.onEnterFrame;
this.boxLoader.alphaTo(0, 1, "linear", 0, undefined);
this.container.alphaTo(100, 1, "linear", 1, undefined);
clearInterval(this.loadComplete);
}
/////////////
};
movieActions.prototype.saveSO = function(so_name){
//mySO = SharedObject.getLocal(so_name);
//check user allows minimum 10k to be stored
//NB if current data is <10k it will be stored immediately and skip ref condition
success = so_name.flush(10000);
if (success == "pending") {
so_name.onStatus = function(result) {
if (result.code == "SharedObject.Flush.Success") {
trace("Sucess writing to disk");
writeSuccess = true;
} else {
trace("Failure writing to disk");
writeSuccess = false;
}
};
} else {
writeSuccess = success;
}
return writeSuccess;//return result
};
movieActions.prototype.deleteSO = function(so_name){
for (a in so_name.data) {
delete so_name.data[a];
}
so_name.flush();
// Delete the SO
delete so_name;
};
movieActions.prototype.goBackOne = function() {
if (user_so.data.locations != undefined) {
trace("previous location: "+user_so.data.location);
}
//check user_so.data.location do a substring to see if prev location within same movie, then check frame number
};
movieActions.prototype.message = function(msg) {
trace(ref+" message: "+msg);
};
main = function(){
trace("loading main");
//destAlpha, seconds, animType, delay, callback, extra1, extra2
intro_mc.alphaTo(0, 0, "linear", 0, null);
logo_mc.alphaTo(100,1,"easeInBack",1,null);
menu_mc.alphaTo(100, 1, "linear", 2, null);
clock_mc.alphaTo(100, 1, "linear", 3, null);
Object.Actions.checkUser();//see if sharedobject
Object.Actions.loadContent("about_inex.swf", 3, "true");
content_mc.alphaTo(100, 1, "linear", 0, null);
};
logout_btn.onRelease = function(){
Object.Actions.logout(user_so);
};
intro_mc.introSkip_btn.onRelease=function(){
trace("skipping intro..");
delete intro_mc.onEnterFrame;
this.enabled=false;//so skip cant be pressed again
main();
};
intro_mc.onEnterFrame=function(){
if(this._currentframe==this._totalframes){
//intro has finished so rewind
this.onEnterFrame=function(){
if(this._currentframe==1){
//intro has been totally rewound, so load menu
delete this.onEnterFrame;
main();//start MAIN
}else{
//intro still has frames to replay
this.prevFrame();
}
};
}else{
//intro not finished play next frame
this.nextFrame();
}
};
Object.Actions = new movieActions(content_mc, content_mc.target_mc);
logo_mc._alpha=menu_mc._alpha=clock_mc._alpha=0;
stop();