# loadVariables

**URL:** <https://forum.kirupa.com/t/loadvariables/28646>\
**Category:** Uncategorized\
**Created:** [August 16, 2003, 2:16am UTC](https://forum.kirupa.com/t/loadvariables/28646 "2003-08-16T02:16:10Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brown0209](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@Brown0209](https://forum.kirupa.com/u/Brown0209)\
**Post date:** [August 16, 2003, 2:16am UTC](https://forum.kirupa.com/t/loadvariables/28646/1 "2003-08-16T02:16:10Z")

</div>

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 =(

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 2:22am UTC](https://forum.kirupa.com/t/loadvariables/28646/2 "2003-08-16T02:22:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 3:23am UTC](https://forum.kirupa.com/t/loadvariables/28646/3 "2003-08-16T03:23:19Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 3:51am UTC](https://forum.kirupa.com/t/loadvariables/28646/4 "2003-08-16T03:51:27Z")

</div>

here is the file. hope somebody can do something with it.  
by the way, thank you for the replys. I joined  
[experts-exchange.com](http://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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 3:53am UTC](https://forum.kirupa.com/t/loadvariables/28646/5 "2003-08-16T03:53:05Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 4:01am UTC](https://forum.kirupa.com/t/loadvariables/28646/6 "2003-08-16T04:01:17Z")

</div>

Check if it works

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 4:09am UTC](https://forum.kirupa.com/t/loadvariables/28646/7 "2003-08-16T04:09:05Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 4:27am UTC](https://forum.kirupa.com/t/loadvariables/28646/8 "2003-08-16T04:27:25Z")

</div>

Here

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 3:29pm UTC](https://forum.kirupa.com/t/loadvariables/28646/9 "2003-08-16T15:29:47Z")

</div>

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! =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 5:10pm UTC](https://forum.kirupa.com/t/loadvariables/28646/10 "2003-08-16T17:10:47Z")

</div>

Here

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:07pm UTC](https://forum.kirupa.com/t/loadvariables/28646/11 "2003-08-16T18:07:53Z")

</div>

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 =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:15pm UTC](https://forum.kirupa.com/t/loadvariables/28646/12 "2003-08-16T18:15:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:26pm UTC](https://forum.kirupa.com/t/loadvariables/28646/13 "2003-08-16T18:26:03Z")

</div>

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.  
😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:27pm UTC](https://forum.kirupa.com/t/loadvariables/28646/14 "2003-08-16T18:27:40Z")

</div>

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.  
🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:49pm UTC](https://forum.kirupa.com/t/loadvariables/28646/15 "2003-08-16T18:49:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:50pm UTC](https://forum.kirupa.com/t/loadvariables/28646/16 "2003-08-16T18:50:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 7:03pm UTC](https://forum.kirupa.com/t/loadvariables/28646/17 "2003-08-16T19:03:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2003, 2:38am UTC](https://forum.kirupa.com/t/loadvariables/28646/18 "2003-08-17T02:38:30Z")

</div>

I just sent you the files. Hope its what you wanted 🙂

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