Welcome to WebmasterWorld Guest from 54.226.32.234

Forum Moderators: open

Message Too Old, No Replies

defaulting dynamically loaded text

defaulting dynamically loaded text request

     

stevenb 1959

11:50 am on Sep 11, 2006 (gmt 0)

10+ Year Member



I have a dynamic text area that I load text into when you click on one the the button links.
My problem is if I am on line 20 ,the when I load a different .txt file of dynamic text in my dynamic text area, that text shows as being on line 20 too.
Anyone know how I can place the newly loaded text so it initially loads at line one.
Any help would be greatly appreciated.
Thanks
Steve

vsgill

1:41 am on Sep 12, 2006 (gmt 0)

5+ Year Member



hi stevenb
its not very clear what is happening with your textfiels without looking at the code...

but what u can try is to clear the textfield before u asign new text to it...

example
when the external text is loaded in the movie then

myTextField.text = "";
myTextField.text = newTextloaded

the other thing which could be wrong is that you might me loading whitespace with the external text...

stevenb 1959

12:20 pm on Sep 12, 2006 (gmt 0)

10+ Year Member



I amnot sure exactly how you code is incorporated into my existing code.

Below is my code, the text files are named the same at this point until I have one dynamically loaded text area functioning properly.
The three dynamically loaded texts are "reviews" in the reviews options area,"features" in the features option area and the "other" in the other options area.

// ----------------<Load CSS>--------------------- \\
var cssStyles:TextField.StyleSheet = new TextField.StyleSheet ();
cssStyles.load("styles/styles.css");
cssStyles.onLoad = function (success:Boolean) {
if (success) {
loadedInfo.styleSheet = cssStyles;
} else {
loadedInfo.text = "There has been a problem loading the requested information. Please contact the Webmaster and report your error.";
}
}
// ----------------</Load CSS>--------------------- \\

//this.loadedInfo.info.load ("vars/tony_hyde_interview.txt");
// ----------------<scroll buttons>--------------------- \\
this.scrollDown.onPress = function() {
scrollDirection = "down";
scrollText();
}
this.scrollUp.onPress = function() {
scrollDirection = "up";
scrollText();
}
this.scrollUp.onRelease = function() {
delete _root.onEnterFrame;
}
this.scrollDown.onRelease = function() {
delete _root.onEnterFrame;
}
function scrollText() {
_root.onEnterFrame = function() {
if (scrollDirection == "up") {
loadedInfo.scroll -= 1;
} else if (scrollDirection == "down") {
loadedInfo.scroll += 1;
}
}
}
// ----------------</scroll buttons>--------------------- \\

//loads text into dynamic text box called loadedinfo
loadText = new LoadVars();
loadText.load("vars/tony_hyde_interview.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
loadedInfo.html = true;
loadedInfo.htmlText = this.loadedInfo;
}
};

// set the alignment of the submenu options to autoSize right
this.reviewsMC.reviews.autoSize = "left";
this.featuresMC.features.autoSize = "left";
this.otherMC.other.autoSize = "left";

// create TextFormat objects that define the states of the submenu options
var btnDisable:TextFormat = new TextFormat("Bitstream Vera Sans", 12, null, true, true);
var btnEnable:TextFormat = new TextFormat("Bitstream Vera Sans", 11, null, false, true);

// disable the submenu option that corresponds to the currently-loaded section
this.ourHistoryMC.ourHistory.setTextFormat(btnDisable);
this.ourHistoryMC.enabled = false;

// re-enable the submenu options
function reEnableOptions() {
this.reviewsMC.enabled = true;
this.reviewsMC.reviews.setTextFormat(btnEnable);
this.featuresMC.enabled = true;
this.featuresMC.features.setTextFormat(btnEnable);
this.otherMC.enabled = true;
this.otherMC.other.setTextFormat(btnEnable);
}

//--------------<Reviews option>-----------------\\
this.reviewsMC.onRollOver = function() {
this.reviews.setTextFormat(btnDisable);
}
this.reviewsMC.onRollOut = function() {
this.reviews.setTextFormat(btnEnable);
}
this.reviewsMC.onRelease = function() {
reEnableOptions();
this.reviews.setTextFormat(btnDisable);
this.enabled = false;
//loadedInfo.text = "";
//loadedInfo.text = newTextloaded
loadText = new LoadVars();
loadText.load("vars/tony_hyde_interview.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
loadedInfo.html = true;
loadedInfo.htmlText = this.loadedInfo;
}
};
}
//--------------</Reviews option>-----------------\\

//--------------<features option>-----------------\\
this.featuresMC.onRollOver = function() {
this.features.setTextFormat(btnDisable);
}
this.featuresMC.onRollOut = function() {
this.features.setTextFormat(btnEnable);
}
this.featuresMC.onRelease = function() {
reEnableOptions();
this.features.setTextFormat(btnDisable);
this.enabled = false;
loadText = new LoadVars();
loadText.load("vars/berlinafeatures.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
loadedInfo.html = true;
loadedInfo.htmlText = this.loadedInfo;
}
};
}
//--------------</features option>-----------------\\

//--------------<OTHERS option>-----------------\\
this.otherMC.onRollOver = function() {
this.other.setTextFormat(btnDisable);
}
this.otherMC.onRollOut = function() {
this.other.setTextFormat(btnEnable);
}
this.otherMC.onRelease = function() {
reEnableOptions();
this.other.setTextFormat(btnDisable);
this.enabled = false;
loadText = new LoadVars();
loadText.load("vars/tony_hyde_interview.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
loadedInfo.html = true;
loadedInfo.htmlText = this.loadedInfo;
}
};
}
//--------------</OTHERS option>-----------------\\

Any help would be greatly appreciated:)
thanks
Steve

 

Featured Threads

Hot Threads This Week

Hot Threads This Month