View Full Version : Text file problem
Blacklion
05-08-2002, 10:24 AM
I have a real simple problem but you know what it's like when you can't get your head around it and it's stupid!
I have a main movie with a movie clip called view. (MX)
'view' has 2 frames, on frame 1 nothing just an actionscript stop.
On frame 2 it has a text box with a scrollbar component attached and an actionscript stop.
There are some buttons in the main movie with the following;
on (release) {
loadVariables("help.txt", "View");
tellTarget ("View") {
gotoAndPlay(2);
}
}
On the theory that when you press a button, it loads the text file into the 'view' and displays it.
I have 2 problems;
1. The first time (and only the first time) that you press a button the scrollbar doesn't work.
2. When you press another button, the 'view' dissapears (instead of refreshing with the new text) if you press it again, it displays correctly, press it again and it dissapears again, and so on, on/off, on/off.
I know I should be able to solve it....but I can't.....aaargh!
PS any way to use the wheel mouse with scrollbar components?
farafiro
05-08-2002, 11:49 AM
Well, I'm not with mx yet but here what I thought when I've read what u do:
when u load anything to any target u should write the whole path so u should right your code like so:
on (release) {
loadVariables("help.txt", "_root.View.textBox");
}
thus, that also means that u don't need 2 frames in ye target MC, only one with a textBox in enough
If u don't want it to be visible b4 loading the externat text file been loaded u can play with its visibility with the same buttons the loads the text file
also there is another good way to do that -if u r interested- u may load the text file from the first frame into _level0, and on the button that shows it make the dynamic text box = the loaded text file
Billy T
05-08-2002, 12:01 PM
Originally posted by farafiro
also there is another good way to do that -if u r interested- u may load the text file from the first frame into _level0, and on the button that shows it make the dynamic text box = the loaded text file
[/list]
so would you have an action like
_root.view.textbox = _root.loaded.txt
?
farafiro
05-09-2002, 01:30 PM
Hey Billy, here is the way:
Make a text file with what ever text u want and puat any name u want b4 the first word, like
myText= blah bla, give it any name u want and save it within the same dir that your swf is in
In your flash file, in the first frame put that code
loadVariablesNum("file.tst",0)
make a button, mc, ..... what ever u want to attach a code to load the text file to a dynamic text box u alredy made or even t a frame, here i say i made a button
on(release){
myDynamicTextBox=myText
}
Tadaaaaaaaaaaaaaaa
Billy T
05-10-2002, 12:24 AM
gotcha
thanks man
Blacklion
05-10-2002, 10:58 AM
most helpful gents .... cheers
farafiro
05-12-2002, 08:30 AM
Originally posted by Billy T
gotcha
thanks man
Any time BOSS
most helpful gents .... cheers
:D :D
Blacklion
05-15-2002, 09:42 AM
Erm......
Tried your way and it's still beating me :(
At the start;
loadVariablesNum("file.txt",0)
Then on the button;
_root.View.Textbox.Text = MyText;
The scrollbars work great.....the text loads instantly....everything is chipper.......apart from the fact that it's lost it's render as HTML elements.
It just shows the text as it is. (with all the HTML markups)
farafiro
05-15-2002, 10:15 AM
Well, have you checked the HTML check box from the text panel
Blacklion
05-15-2002, 11:29 AM
Yes, I have....doesn't make any difference.
If I do it the other way, i.e loading the text on the button press, the HTML works but the scrollbar doesn't!! (first press anyway)
(back to the start!)
I also 'borrowed' some code from the tuts to make my own scrollbar but they don't work so well.....take a long time to refresh and the scroll action is flakey.
......oh so close..my mind gives up! :-)
pinkaboo
05-15-2002, 11:40 AM
check to see if your font is embedded or not, you get that effect if it you've used embedding.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.