View Full Version : using a variable in a path
Digitalosophy
March 25th, 2005, 03:04 PM
I'm curious why this doesn't work.
var whereTo = _global.addressDestination;
addressSubmit.onPress = function(){
trace(_global.addressDestination); // traces address_1_txt which is correct
_root.front_mc.whereTo.text = myAddText.text;
}
whereTo traces, so why doesn't it work?
Thanks!
Abelius
March 25th, 2005, 03:16 PM
I think whereTo and _root.front_mc.whereTo are two different things to Flash...
SmoothDime
March 25th, 2005, 07:27 PM
what are you tring to do?
freakshow
March 25th, 2005, 07:51 PM
I'm curious why this doesn't work.
var whereTo = _global.addressDestination;
addressSubmit.onPress = function(){
trace(_global.addressDestination); // traces address_1_txt which is correct
_root.front_mc.whereTo.text = myAddText.text;
}
whereTo traces, so why doesn't it work?
Thanks!
your problem is that the statement "_root.front_mc.whereTo.text" is telling flash to look for a variable called whereTo on the _root.front_mc timeline, and it doesn't exist.
i think what you want to do is be able to do is use the value of whereTo like this:
"_root.front_mc.whateverIsInTheWhereToVariable.text"
to do that you need to use the following syntax:
_root.front_mc[whereTo].text = myAdd.text;
of course i could have misinterpreted what you were asking for!
Chris
CyanBlue
March 25th, 2005, 08:09 PM
I don't mind you cross forum posting, but it'd be great if you could post what you have found out so that other people does not waste time on something that has been solved already... ;)
http://www.actionscript.org/forums/showthread.php3?t=68569
Digitalosophy
March 25th, 2005, 08:33 PM
ya sorry went out for a bit..
bascially the problem was using the extra variable whereTo, which you can read about in CyanBlue's link.
freakshow
March 25th, 2005, 09:09 PM
ya sorry went out for a bit..
bascially the problem was using the extra variable whereTo, which you can read about in CyanBlue's link.
i think the problem was your dodgy syntax mate.
Digitalosophy
March 25th, 2005, 10:29 PM
possibly..
addressSubmit.onPress = function()
{
_root.front_mc[_global.addressDestination].text = "address_1_txt -- Test 3";
}
worked for me :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.