Been working a little bit on shortening the script in this thing.
Creating the buttons, and then all the script for each button takes up a lot of space.
To as a small start, I created a function to build the regular size buttons.
the Login(2 of these, frame 1 and 3), Logout, Reply, Reload, and Clear
Also, got the small buttons, for the colored text entry. Look for the new button functions
at the bottom of the onSelfLoad event, and then the triggers for each.
//New Button function
buttonMaster("loginBtn", 327, 213, 95, 20, 0xcccccc, "Login", Btn_fmt);
//
As I said, it's only a start, as to shorten it even more I should work on
the mouse over script, for the buttons
That would shorten this script by a lot. with what I've doen so far, it's only
about 36 lines shorter then it was, but with a bit-o work.
onSelfEvent(load){
Stage.scaleMode="noScale"; // Override HTML settings
_global.deBug = true;//
_global.myReload = 2;
_global.who = "";
_global.myMessage = "";
var firstLoad:Boolean = true;
var eggScrolldown:Boolean = false;
var eggScrollup:Boolean = false;
var eggScrollbar:Boolean = false;
var TotalEntries:String;
var postView:String;
var online:String;
var NumLow:Number = 0;
var NumHigh:Number = 10;
//rectangle with outline
myRectangle = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
lineStyle(1, 0x000000, 100);
beginFill(fillColor, fillAlpha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth, boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
};
//rectangle without outline
myRectangle1 = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth, boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
};
//triangle points up
myTriangle1 = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo((boxWidth/2), 2);
lineTo((boxWidth-2), (boxHeight-2));
lineTo(2, (boxHeight-2));
lineTo((boxWidth/2), 2);
endFill();
}
};
//triangle points down
myTriangle2 = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo((boxWidth/2), (boxHeight-2));
lineTo(2, 2);
lineTo((boxWidth-2), 2);
lineTo((boxWidth/2), (boxHeight-2));
endFill();
}
};
//triangle points right
myTriangle3 = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo((boxWidth-2), (boxHeight/2));
lineTo(2, 2);
lineTo(2, (boxHeight-2));
lineTo((boxWidth-2), (boxHeight/2));
endFill();
}
};
//triangle points left
myTriangle4 = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(2, (boxHeight/2));
lineTo((boxWidth-2), 2);
lineTo((boxWidth-2), (boxHeight-2));
lineTo(2, (boxHeight/2));
endFill();
}
};
var inPut_fmt:TextFormat = new TextFormat();
inPut_fmt.color = 0x000000;
inPut_fmt.font = "Verdana";
inPut_fmt.size = 12;
inPut_fmt.align = "left";
var Btn_fmt:TextFormat = new TextFormat();
Btn_fmt.color = 0x000000;
Btn_fmt.font = "Verdana";
Btn_fmt.size = 12;
Btn_fmt.bold = true;
Btn_fmt.align = "center";
var Btn_fmtU:TextFormat = new TextFormat();
Btn_fmtU.color = 0x000000;
Btn_fmtU.font = "Verdana";
Btn_fmtU.size = 12;
Btn_fmtU.bold = true;
Btn_fmtU.underline = true;
Btn_fmtU.align = "center";
var Btn_fmtI:TextFormat = new TextFormat();
Btn_fmtI.color = 0x000000;
Btn_fmtI.font = "Verdana";
Btn_fmtI.size = 12;
Btn_fmtI.bold = true;
Btn_fmtI.italic = true;
Btn_fmtI.align = "center";
var myTxt_fmt:TextFormat = new TextFormat();
myTxt_fmt.color = 0x000000;
myTxt_fmt.font = "Verdana";
myTxt_fmt.size = 11;
myTxt_fmt.bold = true;
myTxt_fmt.align = "center";
var myMain_fmt:TextFormat = new TextFormat();
myMain_fmt.color = 0x000000;
myMain_fmt.font = "Verdana";
myMain_fmt.size = 10;
myMain_fmt.align = "left";
var myMainL_fmt:TextFormat = new TextFormat();
myMainL_fmt.color = 0x000000;
myMainL_fmt.font = "Verdana";
myMainL_fmt.size = 12;
myMainL_fmt.align = "left";
var myMainR_fmt:TextFormat = new TextFormat();
myMainR_fmt.color = 0x000000;
myMainR_fmt.font = "Verdana";
myMainR_fmt.size = 12;
myMainR_fmt.align = "right";
var myMainC_fmt:TextFormat = new TextFormat();
myMainC_fmt.color = 0x000000;
myMainC_fmt.font = "Verdana";
myMainC_fmt.size = 12;
myMainC_fmt.align = "center";
//New Button functions
buttonMaster = function(mainBtn:String, mainX:Number, mainY:Number, mainW:Number, mainH:Number, btnColor:Number, mainName:String, main_fmt:TextFormat):void{
var mainBtn:MovieClip = this.createEmptyMovieClip(mainBtn, this.getNextHighestDepth());
mainBtn._x = mainX;
mainBtn._y = mainY;
mainBtn.createEmptyMovieClip("theBg", mainBtn.getNextHighestDepth());
myRectangle(mainBtn.theBg, mainW, mainH, btnColor, 100);
mainBtn.createTextField("myTxt", mainBtn.getNextHighestDepth(), 0, 1, mainW, mainH);
mainBtn.myTxt.setNewTextFormat(main_fmt);
mainBtn.myTxt.text = mainName;
};
smallBtnmaster = function(smlBtn:String, smlX:Number, smlY:Number, smlW:Number, smlH:Number, smlColor:Number):void{
var smlBtn:MovieClip = this.createEmptyMovieClip(smlBtn, this.getNextHighestDepth());
smlBtn._x = smlX;
smlBtn._y = smlY;
smlBtn.createEmptyMovieClip("theBg", smlBtn.getNextHighestDepth());
myRectangle(smlBtn.theBg, smlW, smlH, smlColor, 100);
};
//
}
onFrame (1) {
setLabel("login1");
if(deBug)trace("deBug = "+deBug);
//New Button function
buttonMaster("loginBtn", 327, 213, 95, 20, 0xcccccc, "Login", Btn_fmt);
//
var myName:TextField = this.createTextField("myName", this.getNextHighestDepth(), 253, 187, 244, 20);
myName.wordWrap = true;
myName.multiline = true;
myName.border = true;
myName.background = true;
myName.type = "input";
myName.setNewTextFormat(inPut_fmt);
loginBtn.onRollOver = function() {
loginBtn.createEmptyMovieClip("theBg", loginBtn.theBg.getDepth());
myRectangle(loginBtn.theBg, 95, 20, 0xffffff, 100);
};
loginBtn.onRollOut = function() {
loginBtn.createEmptyMovieClip("theBg", loginBtn.theBg.getDepth());
myRectangle(loginBtn.theBg, 95, 20, 0xcccccc, 100);
};
loginBtn.onRelease = loginBtn.onReleaseOutside = function() {
if (myName.text == "" || myName.text == "Please enter your name") {
myName.text = "Please enter your name";
Selection.setFocus("myName");
} else {
who = myName.text;
gotoAndPlay("main");
}
};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.ENTER:
if (myName.text == "" || myName.text == "Please enter your name") {
myName.text = "Please enter your name";
Selection.setFocus("myName");
}else {
who = myName.text;
gotoAndPlay("main");
}
break;
}
};
Key.addListener(keyListener);
Selection.setFocus("myName");
stop();
}
onFrame (2) {
setLabel("main");
Key.removeListener(keyListener);
loginBtn.removeMovieClip();
frameTint.removeMovieClip();
myName.removeTextField();
myText.removeTextField();
//////////////////////////////
if(firstLoad){
var whiteBg:MovieClip = this.createEmptyMovieClip("whiteBg", this.getNextHighestDepth());
whiteBg._x = 147;
whiteBg._y = 2;
myRectangle(whiteBg, 600, 390, 0xffffff, 100);
var myMessageTxt:TextField = this.createTextField("myMessage", this.getNextHighestDepth(), 147, 418, 600, 103);
myMessageTxt.wordWrap = true;
myMessageTxt.multiline = true;
myMessageTxt.selectable = true;
myMessageTxt.border = true;
myMessageTxt.background = true;
myMessageTxt.type = "input";
myMessageTxt.setNewTextFormat(inPut_fmt);
var postViewTxt:TextField = this.createTextField("postViewTxt", this.getNextHighestDepth(), 147, 2, 582, 388);
postViewTxt.html=true;
postViewTxt.multiline=true;
postViewTxt.wordWrap=true;
postViewTxt.selectable = true;
postViewTxt.setNewTextFormat(myMain_fmt);
var onlineTxt:TextField = this.createTextField("onlineTxt", this.getNextHighestDepth(), 4, 2, 137, 520);
onlineTxt.html=true;
onlineTxt.multiline=true;
onlineTxt.wordWrap=true;
onlineTxt.selectable = false;
onlineTxt.border = true;
onlineTxt.background = true;
onlineTxt.setNewTextFormat(myMainL_fmt);
var welcomeTxt:TextField = this.createTextField("welcomeTxt", this.getNextHighestDepth(), 272, 395, 181, 20);
welcomeTxt.selectable = false;
welcomeTxt.setNewTextFormat(myMainL_fmt);
var TotalEntriesTxt:TextField = this.createTextField("TotalEntriesTxt", this.getNextHighestDepth(), 450, 395, 181, 20);
TotalEntriesTxt.selectable = false;
TotalEntriesTxt.setNewTextFormat(myMainC_fmt);
var NumHighTxt:TextField = this.createTextField("NumHighTxt", this.getNextHighestDepth(), 692, 395, 36, 20);
NumHighTxt.selectable = false;
NumHighTxt.setNewTextFormat(myMainR_fmt);
var NumLowTxt:TextField = this.createTextField("NumLowTxt", this.getNextHighestDepth(), 654, 395, 36, 20);
NumLowTxt.selectable = false;
NumLowTxt.setNewTextFormat(myMainL_fmt);
var backBtn:MovieClip = this.createEmptyMovieClip("backBtn", this.getNextHighestDepth());
backBtn._x = 636;
backBtn._y = 397;
myRectangle(backBtn, 15, 15, 0xcccccc, 100);
myTriangle4(backBtn, 15, 15, 0x000000, 100);
var nextBtn:MovieClip = this.createEmptyMovieClip("nextBtn", this.getNextHighestDepth());
nextBtn._x = 731;
nextBtn._y = 397;
myRectangle(nextBtn, 15, 15, 0xcccccc, 100);
myTriangle3(nextBtn, 15, 15, 0x000000, 100);
//New button functions
buttonMaster("replyBtn", 461, 526, 95, 20, 0xcccccc, "Reply", Btn_fmt);
buttonMaster("reloadBtn", 556, 526, 95, 20, 0xcccccc, "Reload", Btn_fmt);
buttonMaster("clearBtn", 651, 526, 95, 20, 0xcccccc, "Clear", Btn_fmt);
buttonMaster("logoutBtn", 28, 526, 95, 20, 0xcccccc, "Logout", Btn_fmt);
//
smallBtnmaster("purpleBtn", 252, 397, 15, 15, 0xff00ff);
smallBtnmaster("yellowBtn", 237, 397, 15, 15, 0xffff00);
smallBtnmaster("greenBtn", 222, 397, 15, 15, 0x00ff00);
smallBtnmaster("blueBtn", 207, 397, 15, 15, 0x0000ff);
smallBtnmaster("redBtn", 192, 397, 15, 15, 0xff0000);
//
var underBtn:MovieClip = this.createEmptyMovieClip("underBtn", this.getNextHighestDepth());
underBtn._x = 177;
underBtn._y = 397;
underBtn.createEmptyMovieClip("theBg", underBtn.getNextHighestDepth());
myRectangle(underBtn.theBg, 15, 15, 0xcccccc, 100);
underBtn.createTextField("myTxt", underBtn.getNextHighestDepth(), -2.5,-2.5, 20, 20);
underBtn.myTxt.setNewTextFormat(Btn_fmtU);
underBtn.myTxt.text = "U";
var italicBtn:MovieClip = this.createEmptyMovieClip("italicBtn", this.getNextHighestDepth());
italicBtn._x = 162;
italicBtn._y = 397;
italicBtn.createEmptyMovieClip("theBg", italicBtn.getNextHighestDepth());
myRectangle(italicBtn.theBg, 15, 15, 0xcccccc, 100);
italicBtn.createTextField("myTxt", italicBtn.getNextHighestDepth(), -2.5, -2.5, 20, 20);
italicBtn.myTxt.setNewTextFormat(Btn_fmtI);
italicBtn.myTxt.text = "I";
var boldBtn:MovieClip = this.createEmptyMovieClip("boldBtn", this.getNextHighestDepth());
boldBtn._x = 147;
boldBtn._y = 397;
boldBtn.createEmptyMovieClip("theBg", boldBtn.getNextHighestDepth());
myRectangle(boldBtn.theBg, 15, 15, 0xcccccc, 100);
boldBtn.createTextField("myTxt", boldBtn.getNextHighestDepth(), -2.5, -2.5, 20, 20);
boldBtn.myTxt.setNewTextFormat(Btn_fmt);
boldBtn.myTxt.text = "B";
//ScrollBar//
var sBar1:MovieClip = this.createEmptyMovieClip("sBar1", this.getNextHighestDepth());
sBar1._x = 732.5;
sBar1._y = 2.5;
var eggDown:MovieClip = sBar1.createEmptyMovieClip("eggDown", sBar1.getNextHighestDepth());
sBar1.eggDown._x = 0;
sBar1.eggDown._y = 0;
myRectangle(sBar1.eggDown, 15, 15, 0x999999, 100);
myTriangle1(sBar1.eggDown, 15, 15, 0x000000, 100);
var eggUp:MovieClip = sBar1.createEmptyMovieClip("eggUp", sBar1.getNextHighestDepth());
sBar1.eggUp._x = 0;
sBar1.eggUp._y = 375;
myRectangle(sBar1.eggUp, 15, 15, 0x999999, 100);
myTriangle2(sBar1.eggUp, 15, 15, 0x000000, 100);
var eggBar:MovieClip = sBar1.createEmptyMovieClip("eggBar", sBar1.getNextHighestDepth());
sBar1.eggBar._x = 0;
sBar1.eggBar._y = 16;
myRectangle(sBar1.eggBar, 15, 358, 0x999999, 100);
firstLoad = false;
TotalEntriesTxt.text = "";
postViewTxt.htmlText = "<b>Loading Posts.<br>Please standby...</b>";
onlineTxt.htmlText = "Loading...";
}
//////////////////////////////////////////////
//
//////////Text Format button actions//////////
boldBtn.onRelease = boldBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[b]your text[/b]";
};
boldBtn.onRollOver = function() {
boldBtn.createEmptyMovieClip("theBg", boldBtn.theBg.getDepth());
myRectangle(boldBtn.theBg, 15, 15, 0xffffff, 100);
};
boldBtn.onRollOut = function() {
boldBtn.createEmptyMovieClip("theBg", boldBtn.theBg.getDepth());
myRectangle(boldBtn.theBg, 15, 15, 0xcccccc, 100);
};
//
italicBtn.onRelease = italicBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[i]your text[/i]";
};
italicBtn.onRollOver = function() {
italicBtn.createEmptyMovieClip("theBg", italicBtn.theBg.getDepth());
myRectangle(italicBtn.theBg, 15, 15, 0xffffff, 100);
};
italicBtn.onRollOut = function() {
italicBtn.createEmptyMovieClip("theBg", italicBtn.theBg.getDepth());
myRectangle(italicBtn.theBg, 15, 15, 0xcccccc, 100);
};
//
underBtn.onRelease = underBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[u]your text[/u]";
};
underBtn.onRollOver = function() {
underBtn.createEmptyMovieClip("theBg", underBtn.theBg.getDepth());
myRectangle(underBtn.theBg, 15, 15, 0xffffff, 100);
};
underBtn.onRollOut = function() {
underBtn.createEmptyMovieClip("theBg", underBtn.theBg.getDepth());
myRectangle(underBtn.theBg, 15, 15, 0xcccccc, 100);
};
//
redBtn.onRelease = redBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[font color='#ff0000']your text[/font]";
};
redBtn.onRollOver = function() {
redBtn.createEmptyMovieClip("theBg", redBtn.theBg.getDepth());
myRectangle(redBtn.theBg, 15, 15, 0xffffff, 100);
};
redBtn.onRollOut = function() {
redBtn.createEmptyMovieClip("theBg", redBtn.theBg.getDepth());
myRectangle(redBtn.theBg, 15, 15, 0xff0000, 100);
};
//
blueBtn.onRelease = blueBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[font color='#0000ff']your text[/font]";
};
blueBtn.onRollOver = function() {
blueBtn.createEmptyMovieClip("theBg", blueBtn.theBg.getDepth());
myRectangle(blueBtn.theBg, 15, 15, 0xffffff, 100);
};
blueBtn.onRollOut = function() {
blueBtn.createEmptyMovieClip("theBg", blueBtn.theBg.getDepth());
myRectangle(blueBtn.theBg, 15, 15, 0x0000ff, 100);
};
//
yellowBtn.onRelease = yellowBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[font color='#ffff00']your text[/font]";
};
yellowBtn.onRollOver = function() {
yellowBtn.createEmptyMovieClip("theBg", yellowBtn.theBg.getDepth());
myRectangle(yellowBtn.theBg, 15, 15, 0xffffff, 100);
};
yellowBtn.onRollOut = function() {
yellowBtn.createEmptyMovieClip("theBg", yellowBtn.theBg.getDepth());
myRectangle(yellowBtn.theBg, 15, 15, 0xffff00, 100);
};
//
greenBtn.onRelease = greenBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[font color='#00ff00']your text[/font]";
};
greenBtn.onRollOver = function() {
greenBtn.createEmptyMovieClip("theBg", greenBtn.theBg.getDepth());
myRectangle(greenBtn.theBg, 15, 15, 0xffffff, 100);
};
greenBtn.onRollOut = function() {
greenBtn.createEmptyMovieClip("theBg", greenBtn.theBg.getDepth());
myRectangle(greenBtn.theBg, 15, 15, 0x00ff00, 100);
};
//
purpleBtn.onRelease = purpleBtn.onReleaseOutside = function() {
myMessageTxt.text = myMessageTxt.text + "[font color='#ff00ff']your text[/font]";
};
purpleBtn.onRollOver = function() {
purpleBtn.createEmptyMovieClip("theBg", purpleBtn.theBg.getDepth());
myRectangle(purpleBtn.theBg, 15, 15, 0xffffff, 100);
};
purpleBtn.onRollOut = function() {
purpleBtn.createEmptyMovieClip("theBg", purpleBtn.theBg.getDepth());
myRectangle(purpleBtn.theBg, 15, 15, 0xff00ff, 100);
};
//////////Reply, page Reload, and Clear button actions//////////
replyBtn.onRelease = replyBtn.onReleaseOutside = function() {
myMessage = myMessageTxt.text;
if (myMessageTxt.text == "") {
postViewTxt.htmlText = "Please enter a message to be posted, or <b>Reload</b> to cancel.";
} else if (myMessageTxt.length >= 1) {
Submit = "Yes";
Enter = "No";
Exit = "No";
NumHigh = 10;
NumLow = 0;
loadVariablesNum("dog_chat.php",0,'POST');
myName = who;
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
postViewTxt.scroll = 0;
sBar1.eggBar._y = 16;
}
myMessageTxt.text = "";
sBar1.eggBar._y = 16;
Selection.setFocus("myMessageTxt");
};
replyBtn.onRollOver = function() {
replyBtn.createEmptyMovieClip("theBg", replyBtn.theBg.getDepth());
myRectangle(replyBtn.theBg, 95, 20, 0xffffff, 100);
};
replyBtn.onRollOut = function() {
replyBtn.createEmptyMovieClip("theBg", replyBtn.theBg.getDepth());
myRectangle(replyBtn.theBg, 95, 20, 0xcccccc, 100);
};
reloadBtn.onRelease = reloadBtn.onReleaseOutside = function() {
Enter = "No";
Exit = "No";
Submit = "No";
NumLow = 0;
NumHigh = 10;
loadVariablesNum("dog_chat.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),0);
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
postViewTxt.scroll = 0;
sBar1.eggBar._y = 16;
Selection.setFocus("myMessageTxt");
};
reloadBtn.onRollOver = function() {
reloadBtn.createEmptyMovieClip("theBg", reloadBtn.theBg.getDepth());
myRectangle(reloadBtn.theBg, 95, 20, 0xffffff, 100);
};
reloadBtn.onRollOut = function() {
reloadBtn.createEmptyMovieClip("theBg", reloadBtn.theBg.getDepth());
myRectangle(reloadBtn.theBg, 95, 20, 0xcccccc, 100);
};
clearBtn.onRelease = clearBtn.onReleaseOutside = function() {
myMessageTxt.text = "";
Selection.setFocus("myMessageTxt");
};
clearBtn.onRollOver = function() {
clearBtn.createEmptyMovieClip("theBg", clearBtn.theBg.getDepth());
myRectangle(clearBtn.theBg, 95, 20, 0xffffff, 100);
};
clearBtn.onRollOut = function() {
clearBtn.createEmptyMovieClip("theBg", clearBtn.theBg.getDepth());
myRectangle(clearBtn.theBg, 95, 20, 0xcccccc, 100);
};
//////////page buttons///////////
nextBtn.onRelease = nextBtn.onReleaseOutside = function() {
NumLow = Number(NumLow)+Number(10);
NumHigh = Number(NumHigh)+Number(10);
Enter = "No";
Exit = "No";
Submit = "No";
//postView = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
loadVariablesNum("dog_chat.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),0);
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
postViewTxt.scroll = 0;
sBar1.eggBar._y = 16;
};
nextBtn.onRollOver = function() {
nextBtn.createEmptyMovieClip("theBg", nextBtn.theBg.getDepth());
myRectangle(nextBtn.theBg, 15, 15, 0xffffff, 100);
myTriangle3(nextBtn.theBg, 15, 15, 0x000000, 100);
};
nextBtn.onRollOut = function() {
nextBtn.createEmptyMovieClip("theBg", nextBtn.theBg.getDepth());
myRectangle(nextBtn.theBg, 15, 15, 0xcccccc, 100);
myTriangle3(nextBtn.theBg, 15, 15, 0x000000, 100);
};
backBtn.onRelease = backBtn.onReleaseOutside = function() {
if (NumLowTxt.text == "0") {
NumLow = 0;
NumHigh = 10;
Enter = "No";
Exit = "No";
Submit = "No";
loadVariablesNum("dog_chat.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),0);
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
postViewTxt.scroll = 0;
sBar1.eggBar._y = 16;
} else {
NumLow = Number(NumLow)-Number(10);
NumHigh = Number(NumHigh)-Number(10);
Enter = "No";
Exit = "No";
Submit = "No";
//postView = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
loadVariablesNum("dog_chat.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),0);
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
postViewTxt.scroll = 0;
sBar1.eggBar._y = 16;
}
};
backBtn.onRollOver = function() {
backBtn.createEmptyMovieClip("theBg", backBtn.theBg.getDepth());
myRectangle(backBtn.theBg, 15, 15, 0xffffff, 100);
myTriangle4(backBtn.theBg, 15, 15, 0x000000, 100);
};
backBtn.onRollOut = function() {
backBtn.createEmptyMovieClip("theBg", backBtn.theBg.getDepth());
myRectangle(backBtn.theBg, 15, 15, 0xcccccc, 100);
myTriangle4(backBtn.theBg, 15, 15, 0x000000, 100);
};
//////////Logout button//////////
logoutBtn.onRelease = logoutBtn.onReleaseOutside = function() {
Exit = "Yes";
Enter = "No";
Submit = "No";
loadVariablesNum("dog_chat.php",0,'POST');
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
gotoAndPlay("login2");
};
logoutBtn.onRollOver = function() {
logoutBtn.createEmptyMovieClip("theBg", logoutBtn.theBg.getDepth());
myRectangle(logoutBtn.theBg, 95, 20, 0xffffff, 100);
};
logoutBtn.onRollOut = function() {
logoutBtn.createEmptyMovieClip("theBg", logoutBtn.theBg.getDepth());
myRectangle(logoutBtn.theBg, 95, 20, 0xcccccc, 100);
};
//////////Setting up a few variables//////////
//////////Load php//////////
var Enter:String = "Yes";
var Exit:String = "No";
var Submit:String = "No";
loadVariablesNum("dog_chat.php",0,'POST');
Selection.setFocus("myMessageTxt");
welcomeTxt.text = "Welcome: "+who;
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
//sBar1 eggBar eggUp eggDown//////////////////////////////////
sBar1._visible=false;
sBar1.eggDown.useHandCursor= false;
sBar1.eggUp.useHandCursor= false;
sBar1.eggBar.useHandCursor= false;
//////////////////////////////////////////////////////////////
sBar1.onEnterFrame = function() {
// sBar1 //
if (postViewTxt.maxscroll < 2) {
sBar1._visible=false;
} else {
sBar1._visible=true;
sBar1.eggBar._yscale = 100*(28/(28+postViewTxt.maxscroll));
}
// eggDown //
if (postViewTxt.scroll <= 0 || sBar1.eggBar._y <= 16) {
eggScrolldown = false;
sBar1.eggBar._y = 16;
} else if (eggScrolldown == true) {
postViewTxt.scroll = sBar1.eggBar._y/(358+sBar1.eggBar._height+17)*100-(postViewTxt.maxscroll/28)-2;
sBar1.eggBar._y += ((sBar1.eggBar._height-358+17)/postViewTxt.maxscroll);
}
// eggUp //
if (sBar1.eggBar._y >= 358-sBar1.eggBar._height+17) {
eggScrollup = false;
sBar1.eggBar._y = 358-sBar1.eggBar._height+17;
} else if (eggScrollup == true) {
postViewTxt.scroll = sBar1.eggBar._y/(358+sBar1.eggBar._height+17)*100-(postViewTxt.maxscroll/28)-2;
sBar1.eggBar._y -= ((sBar1.eggBar._height-358+17)/postViewTxt.maxscroll);
}
// eggBar //
if (eggScrollbar == true) {
postViewTxt.scroll = sBar1.eggBar._y/(358+sBar1.eggBar._height+17)*100-(postViewTxt.maxscroll/28)-2;
}
};
// scrollWheel Script //
// scrollWheel Script //
mySListener = new Object();
mySListener.onMouseWheel = function (delta:Number){
if ((sBar1.eggBar._y >=16) && (sBar1.eggBar._y <= 358-sBar1.eggBar._height+17.5) && (postViewTxt.maxscroll >0)){
postViewTxt.scroll -= 1*delta;
sBar1.eggBar._y -= delta*((358-sBar1.eggBar._height+17)/postViewTxt.maxscroll);
}
if ((sBar1.eggBar._y >= 358-sBar1.eggBar._height+17) && (postViewTxt.maxscroll >0)){
sBar1.eggBar._y = (358-sBar1.eggBar._height+17);
}
if ((sBar1.eggBar._y < 16) && (postViewTxt.maxscroll >0)){
sBar1.eggBar._y = 16;
}else{
postViewTxt.scroll -= 0*delta;
}
};
Mouse.addListener(mySListener);
//////////Scrollbar button actions//////////
sBar1.eggBar.onPress = function(){
sBar1.eggBar.startDragUnlocked(0,0,16,358-sBar1.eggBar._height+17);
eggScrollbar = true;
};
sBar1.eggBar.onRelease = sBar1.eggBar.onReleaseOutside = function(){
sBar1.eggBar.stopDrag();
eggScrollbar = false;
};
sBar1.eggUp.onPress = function(){
eggScrollup = true;
};
sBar1.eggUp.onRelease = sBar1.eggUp.onReleaseOutside = function(){
eggScrollup = false;
};
sBar1.eggDown.onPress = function(){
eggScrolldown = true;
};
sBar1.eggDown.onRelease = sBar1.eggDown.onReleaseOutside = function(){
eggScrolldown = false;
};
////////////////////////////////////////////////////////////////
////////////////////////Timer Function//////////////////////////
////////////////////////////////////////////////////////////////
var myCounter:Number = myReload;
countDown = function():void {
myCounter--;
if(myCounter == 0){
myCounter = myReload;
//if (NumLow == 0) {
Enter = "No";
Exit = "No";
Submit = "No";
loadVariablesNum("dog_chat.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999),0);
NumLowTxt.text = NumLow;
NumHighTxt.text = NumHigh;
TotalEntriesTxt.text = String(TotalEntries);
postViewTxt.htmlText = String(postView);
onlineTxt.htmlText = String(online);
if(deBug)trace("triggered");
//}
}
};
var timer:Number = setInterval(countDown, 1000);
if(deBug)trace("myReload "+myReload);
stop();
}
onFrame (3) {
setLabel("login2");
Mouse.removeListener(mySListener);
var frameTint:MovieClip = this.createEmptyMovieClip("frameTint", this.getNextHighestDepth());
frameTint._x = 0;
frameTint._y = 0;
myRectangle1(frameTint, 750, 550, 0xcccccc, 75);
frameTint.onRollOver = function() {
//do nothing
};
frameTint.useHandCursor = false;
//New Button function
buttonMaster("loginBtn", 327, 213, 95, 20, 0xcccccc, "Login", Btn_fmt);
//
var myText:TextField = this.createTextField("myText", this.getNextHighestDepth(), 235, 165, 279, 40);
myText.wordWrap = true;
myText.multiline = true;
myText.html = true;
myText.selectable = false;
myText.setNewTextFormat(myTxt_fmt);
myText.htmlText = "Thanks for stopping by "+who+".<br />To log back in, click button";
loginBtn.onRollOver = function() {
loginBtn.createEmptyMovieClip("theBg", loginBtn.theBg.getDepth());
myRectangle(loginBtn.theBg, 95, 20, 0xffffff, 100);
};
loginBtn.onRollOut = function() {
loginBtn.createEmptyMovieClip("theBg", loginBtn.theBg.getDepth());
myRectangle(loginBtn.theBg, 95, 20, 0xcccccc, 100);
};
loginBtn.onRelease = loginBtn.onReleaseOutside = function() {
gotoAndPlay("main");
};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.ENTER :
gotoAndPlay("main");
break;
}
};
Key.addListener(keyListener);
stop();
}
/////////////////////End of Script, and notes////////////////////////////