I actually had it working earlier, but accidentaly erased the code that made it work. I have a text file that says:
taken=x7y7
Now, what I want Flash to do with that is tell a movieClip called x7y7 to gotoAndStop(2);. I think I used LoadVars() to get it to work. This was the last chuck of code that I tried:
lv = new LoadVars();
lv.onLoad = function (success){
if (success){
_root.crap = this.taken;
trace (crap);
_root[crap].gotoAndStop(2);
}
}
lv.load("taken.txt");
I’m using the individual pieces of code in other places, so I know that it works, just not here. Am I missing something?? Or does anyone have a different idea??
Well everything works peachy keen for me, but I don’t see why you don’t just use [AS]lv = new LoadVars();
lv.onLoad = function(success) {
if (success) {
_root[this.taken].gotoAndStop(2);
}
};
lv.load(“taken.txt”);[/AS] Unless you are using the variable _root.crap for something else?
Also might be a targeting issue, so make sure your targeting is correct.
*Originally posted by lostinbeta *
**Only if the code isn’t already on the _root timeline. **
Yes, but Freddy didn’t say exactly where he placed it, so I figured the best option would be to use _root anyway. If you place it on _root, _root.crap while crap is in _root will still work right ?
Although as some may know (or find out), _root is evil :bad: Relative addressing using this and _parent is usually the best way to go, it makes the code more portable.
Yeah, my code is on the root as evil as it may be. But that movieClip called x7y7 still doesn’t do anything. And ‘crap’ is only used in that chunck of code there. I don’t know what _root[_root.crap].gotoAndStop(2); will do, so I’ll have to give that a try.
Eyez - I also had tried the ampersand in front, nothing changed. It’s actually, once working, will be a list printed from a database by a PHP script so it’ll be like:
&taken1=x7y7&taken2=x4y3&taken3=x9y0…etc
That way I can change all the blocks that are taken by other people. But thank you!
Lost - All the movieClips (ie ‘x7y7’) are on the main stage so I thought that was how I was supposed to target. I tried 'this’s instead of _root’s to no avail, but I will try your suggestion. If at all possible, could you post a fla that works like that? That way I could figure it out for sure. Like I said, I had this stupid thing working before, and now I can’t remember how to do it!! Arrgh!! So…Frustrating…
Nope, the code isn’t working and I’m not sure why. The trace window shows that the variable is being recieved, but the movieClip isn’t being told to go to the next frame. Can I use something else?
Okay Voetsjoeba - good luck my man! I do have to warn you, it’s a bit messy because I’m trying to get the function before the looks. The submit php thing on the button works like a charm, by the way - the only prob is geting the green boxes to turn red with the incomming variable. You’ll see what I’m trying to do. Make sure you make the text file that says:
&taken=x7y7
So the the box at x7 and y7 is supposed to turn red on loading. I think you know all this already and don’t know why I keep repeating myself. Sorry. I’ll just post - thanks man!
What the crap?? Good to see you again Ahmed!! That’s the thing. I haven’t written the PHP for it yet. I just wanted it to work from the text file first, then I could have a PHP script write the text file ahead of time; therefore, I don’t have one.
I guess I’ll try it one more time serverside instead of running it local, but it should work anyway…right???
…my nose is bleeding!! (just kidding :P)
I just tried it server side (same fla in the zip file) and still nothing. I guess I’ll try the grenade, instead.
Thanks for your help guys. Must be my system somehow. I’ll have to try it on someone else’s I guess. Still doesn’t make much sense though.
You know. I’m getting really POed!! I just made this little ditty to see if it’s me. 'Cause I didn’t think it was me!! I paid a lot of attention on our earlier discussions with LoadVars()…So I made a seperate fla with the same [explitive deleted] code and the same [explitive deleted] text file and it works. Why the crap do you think one file works and one doesn’t??
I don’t know…maybe it is time for the grenade…eerrrr!!
Here’s the test I made that works - tell me if you see something different; maybe I’m just retarded.
Make a text file that has:
&well=dot
and call it crap.txt
Works like a dream…So…Angry…