PDA

View Full Version : problem loading variables to other movie clips


barkers
07-12-2001, 10:55 AM
i am trying to use loadvariables to to assing values to variables in another movie clip and having problems.
this is quite a difficult problem to explian, bear with me....

i recieve the variables in a clip called:
_level0.loadVars
i am using loadVaraibles several time during the movie, and this is used to recieve all the data.
some of the varables that are recieved need to bee assigned to other movie clips. when i tried sending then (from perl script) like this: _level0.clip1.clip2.clip3.variable, it didnt work (this the variable is _level0.loadVars._level0.clip1.clip2....etc).

got round that by creating a reference to clip3 in the loadVars clip:
var ref = _level0.clip1.clip2.clip3;

this works, but only for assigning values to textboxes, not for variables.

I need to find a way around this, can anyone help?

cant send a string of variables names and values and split them, because theres too much info. it crashes flash.
so i have to assign values to them directly


thanks
barkers

Jesse
07-12-2001, 01:18 PM
eek, can you post the source or a schematic diagram of the structure coz you lost me (then again I have had only 2 hours sleep in 3 days so I might be a bit slow tonight :) ) and what do you mean that it works for text fields (which are string variables by the way) and not for 'variables'?

barkers
07-12-2001, 01:19 PM
did any one even understand what i was talking about.

i found out whats happenning now. this is it (incase anyone knows anything about this)
the variales that are recieved by the clip _level0.loadVars
are like this:
myclip.1.mainText=sumtext+and+stuff&myclip.1.status=1&myclip.2.mainText=more+text&myclip.2.status=4

myclip is a reference to _level0.clip1.clip2.clip3

mainText is a textbox in a movieclip called '1' and another called '2'
status is a variable found in the sames places.

when i load the data, the texts are shown in the boxes (and i suspect that the values assigned to the varaibles), however i cannot access these. every time i trace them it thinks the values have not been assigned.

if i do a list variables i can see
_level0.loadVars.myclip.1.mainText="sumtext and stuff"
_level0.loadVars.myclip.1.status=1
....

_level0.clip1.clip2.clip3.1.mainText=""


its like it hasnt updated the value but has displayed the text in the right boxes.
its really confusing. can anyone shed som light on what the hel is going on.
c'mom jesse you seem to have all the answers

barkers

Pawn Rush
07-19-2001, 10:15 AM
I know what you are talking about. I have run into a similar problem myself. When you loadVariables it runs on a different thread, so they may not be loaded by the time you try to access them within the same function. Try debuging this by assigning the loadVariables portion of your code to a seperate button Then continue whatever process requires the variables. It should work then.

Let me know how it goes.

barkers
07-19-2001, 10:27 AM
i dont quite understand what you're saying.
Its not that the values are taking a long time to be assigned. I try to access some textbox variables, which i can see have been assigned. but flash doesnt find any value. if i wait and do it again (its basically a simple search that im doing), it still doesnt find a value.

if i have actually typed text in the boxes and then export it, the imported variables overwrite the data in the boxes.
which can clearly be seen on the screen. But when i perform the search for the new values, they're not found. when i search for the values i typed, they are found.

marielisa
03-26-2006, 07:33 PM
Sounds like the same problem. I was hoping to find an answer here.

What I'm trying to do is to load variables from a txt file:
_root.loadVariables("playlist.txt")

Since I'm loading them to the root, I should be able to pass them on to other variables.
Like barkers said, these variables are displayed in any textfield with the same variable name, as long as it is placed on the root.

If my playlist.txt has the following variables, for example:
song1=&mysong.mp3
song2=&mysong2.mp3
...etc


and then if I try to pass this value to any movie clip or to another variable, like this:
completeurl = "mp3folder/"+_root.song2;

the value of song2 that I loaded into the root won't pass to the completeurl value

even if i just pass it on without adding anything else:

_root.playthissong = _root.song2;

the value of _root.playthissong is unnassigned.

Also if i have a movie clip with a dynamic textfield with variable name song2 and on that same movie clip or on the root I assign
_root.movieclipname.song2 = _root.song2;
it comes out as undefined

I usually solve it by loading variables in any movie clip where I need them but I'm guessing this isn't very efficient. And most of all, if i have a playlist that switches the number of song i can't pass on the songname to another variable, like this:


playthisone = _root["song"+_root.currentnumber];




does anybody know how to pass loaded variables to other variables and other movie clips?