-
Positioning a movie clip using external variables.
Hi,
I'm trying to position a movie clip inside a flash movie using variables stored in a text file.
I'm using a php file to write and then read from a text file. This all works fine and my flash movie is able to do both these things.
However when I try to use the variables to position the X and Y values of the movie clip, I'm unable to do so. the movie just wont pick up the variables that are in the movie (I can see the values of one_xpos and one_ypos in text fields in the movie so they ARE being read and ARE in the movie).
The first thing I've been doing is loading the variables 'one_xpos' and 'one_ypos' using a php file:
loadVariablesNum("http://www.website.com/folder/messageboards/php_text.php", 0);
I've then made sure the variables are numbers:
one_xpos = Number(one_xpos);
one_ypos = Number(one_ypos);
I've then tried to use these two variables to set the position of the movie clip:
setProperty("01", _x, one_xpos);
setProperty("01", _y, one_ypos);
this doesn't work for some reason.
When I don't load the variables but instead give one_xpos and give one_ypos values inside the movie it works and moves my movie clip!!
This is so frustrating please help.
Cheers
Ben.
Last edited by aitukltd2; 10-29-2002 at 11:22 AM.
-
Hi,
2 things:
1)You need to make sure the variables are loaded before calling them.
You can use onClipEvent(data) but you are loading on _level0 so, unless you work with MX (where you can use the onData function for _level0) that would mean changing where the vars are loaded.
Or you can add a variable on the external file (for example: &loaded=true& ) and check whether that var exists.
2) to convert the string back to a number use parseInt:
one_xpos = parseInt(one_xpos);
one_ypos = parseInt(one_ypos);
gparis
-
Bonjour Paris,
merci beaucoup!! c'est bon!!! It works thank you SO, SO, SO, SO much.
I used both your suggestions and they both work perfectly. My work mate and I had been struggling with this one for quite some time.
Thanks again.
-
Bienvenue / You're welcome
gparis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|