PDA

View Full Version : problems with "loadVariablesNum();"



Simon Alibert
September 19th, 2003, 08:00 AM
Hi all,

Well, I'm a newbie in AS, I found a easy srollbar tutorial, it's working, but I would like to have a separate txt file, to edit the text quickly..

I think it's with this command "loadVariablesNum();" but it's does work with me :-\

This the code I have :
onClipEvent (load){

daTextBox = "<P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#5B5642\"><B>my text go there</B></FONT></P>";
scrolling = 0;
frameCounter = 1;
speedFactor = 3;

}

onClipEvent (enterFrame){

if( frameCounter % speedFactor == 0){

if( scrolling == "up" && daTextBox.scroll > 1){

daTextBox.scroll--;

}


else if( scrolling == "down" && daTextBox.scroll < daTextBox.maxscroll){

daTextBox.scroll++;

}

frameCounter = 0;
}

frameCounter++;
}

What should I do now ?
My txt file is called txtnews.txt, it's in the same folder..

Tons of thanks in advance !

Syntax
September 19th, 2003, 09:35 AM
onClipEvent (load) {
this.loadVariables("txtnews.txt");
daTextBox = textnews;
}

your text file should be like this : textnews=value&variable2=value2

Simon Alibert
September 19th, 2003, 10:07 AM
Thanks "Syntax" !

But I can't understand why it's still not working (heu yeah I know it's my mistake :m:)

well this is my txtnews.txt source :textnews=value&variable2=my text go there ???

and there my AS script :onClipEvent (load ) { this .loadVariables ("txtnews.txt");
daTextBox = textnews;
scrolling = 0;
frameCounter = 1;
speedFactor = 3;
}
onClipEvent (enterFrame) {
if (frameCounter%speedFactor == 0) {
if (scrolling == "up" && daTextBox.scroll>1) {
daTextBox.scroll--;
} else if (scrolling == "down" && daTextBox.scroll<daTextBox.maxscroll) {
daTextBox.scroll++;
}
frameCounter = 0;
}
frameCounter++;
}


It seems pretty ok for me, but keep in mind this is It's my first week in AS :whistle:

Thanks again !

Syntax
September 19th, 2003, 01:55 PM
oh sorry, you misunderstood my example.

i post you the correct way to write a text file with multiple variables

in your case is:

textnews=myTextGoHere

if you have to write a txt file with more varialbes you use a & to separate variables

variable1=value1&variable2=value2&variable3=value3

Simon Alibert
September 19th, 2003, 02:48 PM
Originally posted by Syntax
oh sorry, you misunderstood my example.

Yeah :whistle:

But finally, It works !!
Thanks a lot Syntax !