loadVariables

Hi. Im new to flash and Im having a problem loading the
variables in a movie, from a button on another movie.
Here is the situation:

I have 3 movies (swf’s).
1 is the main movie
2 is a navigation bar menu
and the 3rd is a submenu from the navigation bar menu

I made it this way so it is easy for me to update the buttons contained on the
sub menu. Anyway, on the main movie (1) I have a dynamic text field with a scroller.
I need to initialize a variable from the submenu (3) button to make the scroller work
for the dynamic text field. Here is the code I am using in the button from the submenu (3)
to do so:

on (release){
_parent._parent.loadVariables(“hippop.txt”,"_root");
loadText = new loadVars();
loadText.load(“hippop.txt”);
//creating the loadVarsText function
loadText.onLoad = function() {
cdnametext.text = this.cdname;
cdinfotext.text = this.cdinfo;
cdtrackstext.text = this.cdtracks;
loadMovie(“hippop.jpg”,"_parent._parent.imageContainer")
_parent.gotoAndPlay(“main”);
}
}

everything works fine except for the variables being loaded.
I know the problem is located somewhere in this line of code:

_parent._parent.loadVariables(“hippop.txt”,"_root");

I tried different variations like:

_parent.loadVariables(“hippop.txt”,"_root");

_parent._parent.loadVariables(“hippop.txt”,"_parent._parent.");

_parent._parent.loadVariables(“hippop.txt”,"_root.cdtracks");

etc.

can someone please help me figure out what the correct code is
or what I am doing wrong? All of the variable are defined on my main movie
and it works fine if I place the button on the main movie. I just can get it
to work from movie (3) where it is supposed to work from =(

Can you post your FLA’s in a zip file?:player:

Maybe this?[AS]function loadData() {
var loadText = new LoadVars();
loadText.load(“hippop.txt”);
loadText.onLoad = function(success) {
if (success) {
submenu.cdnametext.text = this.cdname;
submenu.cdinfotext.text = this.cdinfo;
submenu.cdtrackstext.text = this.cdtracks;
loadMovie(“hippop.jpg”, imageContainer);
_root.gotoAndPlay(“main”);
}
};
}
submenu.button.onPress = loadData;[/AS]

here is the file. hope somebody can do something with it.
by the way, thank you for the replys. I joined
experts-exchange.com 4 days ago and still, no one
has replyed. I got a reply here within about 4 mins.
Thanks again, this stupid problem is holding my
whole website up. Laterz!

Also, i tried your code claudio,
but I couldnt get it to work.
Maybe I pasted it in wrong???
Thanks anyway
I appretiate it :sigh:

Check if it works

i checked the file and everything has changed.
you got the text to display in their
correct dynamic text boxes in the main movie,
but I already had the text appearing in the
main movie. All I am trying to do is to get the scroller
in the main movie to scroll when the text is to large
to fit into the dynamic text box. Is there anyway
you can please take another look at it. Thank you
again!

Here

Thanks claudio!
Youre awesome!

You fixed the problem I was having,
but now I am having a different problem.
Whenever I load new text into the same dynamic text box
(with a new button I added), the scroller doesnt seem
to re-adjust to the new text. If the text displayed in the text box
doesnt need to be scrolled the the scroller should be disable.
If the text new text displayed in the text box is longer
than the text current displayed, the scroller should readjust
to the height of the new text.
Do you have any hint on how I might do this?
If nto, thanks anyway! =)

Here

can you explain this code to me, because the
scroll bar still is not readjusting to the displayed text.

_root.cdtrackstext.scroll = 0;
(_root.cdtrackstext.scroll != _root.cdtrackstext.maxscroll) ? _root.myScrollBar._visible=true : _root.myScrollBar._visible=false;

was that the only code you added? or was their more.
that was all i noticed. thank you =)

hmmmmmmmm
interesting Phil…
VERY INTERESTING!
lol
yes this forum is friendly enough for me!
I wish I could give claudio a cookie or sumtin!
i cant tell you how much he has lifted off of my mind.
Especially after the problems ive havebeen having with
my sound card, i was ready to throw my computer out the
window. But we wont go there. Ill get all worked up
again about how stupid Creative Labs tech support is.
Thanks again! (I wish I got a nickle for every time I said thanks.)
Laterz!

PS: Snoopy and Lucy are doin great

I added that inside the onLoad function, which means everytime eurotrax.txt is loaded, flash will check if the scrollbars are needed or not.
Try changing the content of eurotrax.txt and youll see.

As for using with another button, it wont work.
Let me correct that for you.
:wink:

Ok, ive added a function to detect if the scrollbar is needed or not.
I also added a dummy button, just to load another txtfile so you can check if it works.
Hope it helps.
:slight_smile:

claudio, do you mind if I send you the whole file I am trying
to get working so you can see what is really going on,
because I am trying to go back and forth between this dummy
file I created and the real file I am trying to work on. The only reason I did this is so who ever was helping me didnt get confused, but I think I can explain this pretty easily for you to see what is going on? Please let me know, because I still can not get it to work. THANK U!!! =P

ps: by the way, very funny posting my reply into the program

Ok, you can send me the files on ********
I have to leave in a few minutes, but ill check the file later.
:wink:

great, oh…and did i say thanks
thanks =)

I just sent you the files. Hope its what you wanted :slight_smile:

PS: Can you send me music files? :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: (just kidding ;))