PDA

View Full Version : linking to .txt files


abd
05-08-2006, 05:12 AM
hi
im trying to load a text file into flash so that im not continually updating the flash file.
is there a way of achieving this, also ive been messing around with scrolling text boxes. please have a look at the one attatched and let me know what ive done wrong.(the text doesnt appear)
also, will it be easy to link the txt file to this file?

Saroj
05-08-2006, 05:32 AM
hi abd ,

i have attached one zip file just check it and try to incorporate the same thing to your work. i dont have time to go thru your code.

I am sure my attached file will solve your problem.

Cheers!
Saroj

abd
05-08-2006, 05:48 AM
every time i open your file it crashes flash mx?

Saroj
05-08-2006, 12:53 PM
Because i made it in Flash 8 and i think you are using Flash MX.

Saroj
05-08-2006, 12:55 PM
this is the code:
ms = textbox.Message.maxscroll;
scale = scrollheight/ms;
if (ms>1) {
if (!dragpress) {
textbox.scrollbar.scrollbox._yscale = 300/textbox.Message.maxscroll;
textbox.scrollbar.scrollbox._y = -(scrollheight/2)+((textbox.Message.scroll-1)*scale);
if (!textbox.scrollbar._visible) {
textbox.scrollbar._visible = true;
}
textbox.scrollbar.scrollbox._y = boxypos
} else if (textbox.scrollbar.scrollbox._y<-(scrollheight/2)+1 and move<0) {
move = 0;
textbox.scrollbar.scrollbox._y = -(scrollheight/2);
} else if (textbox.scrollbar.scrollbox._y+textbox.scrollbar. scrollbox._height>(scrollheight/2)-1 and move>0) {
move = 0;
textbox.scrollbar.scrollbox._y = scrollheight/2;
} else {
scrollfix = textbox.Message.scroll = ((textbox.scrollbar.scrollbox._y+(scrollheight/2))/scale)+1;
boxypos = textbox.scrollbar.scrollbox._y = textbox.scrollbar.scrollbox._y+(move*scale);
}
} else {
if (textbox.scrollbar._visible) {
textbox.scrollbar._visible = false;
}
}

Saroj
05-08-2006, 12:58 PM
//to adjust the height you can add:
scrollheight = textbox.scrollbar.scrolltrack._height;

//Already i given you message.txt file so
//To load the text file
loadVariables("message.txt", "");
stop();

//To move UP

on (press) {
if (_root.textbox.Message.scroll>1) {
_parent._parent.dragpress = 1;
_parent._parent.move = -1;
}
}
on (release) {
_parent._parent.dragpress = 0;
_parent._parent.move = 0;
}

// TO move Down

on (press) {
if (_parent._parent.textbox.Message.scroll<_parent._parent.textbox.Message.maxscroll) {
_parent._parent.dragpress = 1;
_parent._parent.move = 1;
}
}
on (release) {
_parent._parent.dragpress = 0;
_parent._parent.move = 0;
}

// to scroll on the scroll bar (middle bar)

on (press) {
_parent._parent._parent.dragpress = 1;
startDrag("", false, Math.floor(_x), _parent.scrollboxtop, Math.floor(_x), (_parent.scrolltrack._height+_parent.scrollboxtop)-_height);
}
on (release, releaseOutside) {
_parent._parent._parent.dragpress = 0;
stopDrag();
}

Saroj
05-08-2006, 01:03 PM
I converted my Flash 8 file to MX. Go thru the file which will tell how to attache text file in flash.

Sorry! i dont have time to go thru your code.

If you can open my example then you can better understand and can meet your requirements.

All the best...
Bye
Saroj

abd
05-08-2006, 09:20 PM
thanks Saroj! :)