RE: [Flashcoders] How to get value of passed array element SOLVED!!!!
Chris, Thank you - that worked. I also deserve a boot in the nether regions -- I've done loops where the array index has been accessed by a variable scores of times. This time? Absolutely blind - convinced I had to create the var, then evaluate the contents. Again, thanks for removing the blinders. Regards - Miles At 09:18 AM 11/1/2005, you wrote: Try this Pass the number of the array reference then use... function addStory(stryElement:Number):Void{ // assign contents of passed array element to text control. txtNews.html = True; txtNews.htmlText = _root.arrStorys[stryElement]; txtNews.refresh; } -- The quotation marks on your code below make a string txtNews.text = "_root.arrStorys[" + stryElement + "]"; Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Miles Thompson Sent: 31 October 2005 20:30 To: Flashcoders mailing list Subject: [Flashcoders] How to get value of passed array element I have a text field of references, like so ... BULLETIN:SPECULATION HOUNDS SEAMARK HEADLINES OCTOBER 31, 2005 FORBES SEESFUTURE IN THE TUBE KEATING SEESFUTURE IN WIRELESS INTERNET and clicking on any of them triggers addStory(). If I click on "FORBES SEES ..." the text area which is supposed to display the story, displays this instead: _root.arrStorys[2] At least it's displaying something!! I really need the contents of the array, however. I know that asfunction passes the parameter as a string, how do I convert it so the contents of that array element display? In other words, so that it's a pointer rather than a label, to put it another way. Here's what I have for the function: function addStory(stryElement:Array):Void{ // assign contents of passed array element to text control. txtNews.html = True; txtNews.text = stryElement; txtNews.refresh; } I also tried passing just the number of the desired array element, assembling it like so: txtNews.text = "_root.arrStorys[" + stryElement + "]"; but all it displayed was the name of the element, eg _root.arrStorys[2], not what that element contains. String, Array and Object have all been tried for the type of stryElement. FoxPro had a macro command, so that you could, in a situation like this where the name of the variable rather than its contents displays, force the contents, like so: &stryElement. Guidance and suggestions will be most welcome. Thanks - Miles Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] How to get value of passed array element
Try this Pass the number of the array reference then use... function addStory(stryElement:Number):Void{ // assign contents of passed array element to text control. txtNews.html = True; txtNews.htmlText = _root.arrStorys[stryElement]; txtNews.refresh; } -- The quotation marks on your code below make a string txtNews.text = "_root.arrStorys[" + stryElement + "]"; Chris Wilcox Bounce Digital Ltd 12 Goslett Yard | London | WC2H 0EQ UK T +44(0)207 478 4488 | www.bouncedigital.co.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Miles Thompson Sent: 31 October 2005 20:30 To: Flashcoders mailing list Subject: [Flashcoders] How to get value of passed array element I have a text field of references, like so ... BULLETIN:SPECULATION HOUNDS SEAMARK HEADLINES OCTOBER 31, 2005 FORBES SEESFUTURE IN THE TUBE KEATING SEESFUTURE IN WIRELESS INTERNET and clicking on any of them triggers addStory(). If I click on "FORBES SEES ..." the text area which is supposed to display the story, displays this instead: _root.arrStorys[2] At least it's displaying something!! I really need the contents of the array, however. I know that asfunction passes the parameter as a string, how do I convert it so the contents of that array element display? In other words, so that it's a pointer rather than a label, to put it another way. Here's what I have for the function: function addStory(stryElement:Array):Void{ // assign contents of passed array element to text control. txtNews.html = True; txtNews.text = stryElement; txtNews.refresh; } I also tried passing just the number of the desired array element, assembling it like so: txtNews.text = "_root.arrStorys[" + stryElement + "]"; but all it displayed was the name of the element, eg _root.arrStorys[2], not what that element contains. String, Array and Object have all been tried for the type of stryElement. FoxPro had a macro command, so that you could, in a situation like this where the name of the variable rather than its contents displays, force the contents, like so: &stryElement. Guidance and suggestions will be most welcome. Thanks - Miles Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ This email has been scanned by the MessageLabs Email Security System. __ __ This email has been scanned by the MessageLabs Email Security System. __ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How to get value of passed array element
I have a text field of references, like so ... BULLETIN:SPECULATION HOUNDS SEAMARK HEADLINES OCTOBER 31, 2005 FORBES SEES/>FUTURE IN THE TUBE KEATING SEES/>FUTURE IN WIRELESS INTERNET and clicking on any of them triggers addStory(). If I click on "FORBES SEES ..." the text area which is supposed to display the story, displays this instead: _root.arrStorys[2] At least it's displaying something!! I really need the contents of the array, however. I know that asfunction passes the parameter as a string, how do I convert it so the contents of that array element display? In other words, so that it's a pointer rather than a label, to put it another way. Here's what I have for the function: function addStory(stryElement:Array):Void{ // assign contents of passed array element to text control. txtNews.html = True; txtNews.text = stryElement; txtNews.refresh; } I also tried passing just the number of the desired array element, assembling it like so: txtNews.text = "_root.arrStorys[" + stryElement + "]"; but all it displayed was the name of the element, eg _root.arrStorys[2], not what that element contains. String, Array and Object have all been tried for the type of stryElement. FoxPro had a macro command, so that you could, in a situation like this where the name of the variable rather than its contents displays, force the contents, like so: &stryElement. Guidance and suggestions will be most welcome. Thanks - Miles Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders