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 ...
<A HREF='asfunction:_root.addStory, _root.arrStorys[0]'>
<b>BULLETIN:SPECULATION HOUNDS SEAMARK</b></A>
<A HREF='asfunction:_root.addStory, _root.arrStorys[1]'> <b>HEADLINES
OCTOBER 31, 2005</b></A>
<A HREF='asfunction:_root.addStory, _root.arrStorys[2]'> <b>FORBES
SEES<br
/>FUTURE IN THE TUBE</b></A>
<A HREF='asfunction:_root.addStory, _root.arrStorys[3]'> <b>KEATING
SEES<br
/>FUTURE IN WIRELESS INTERNET</b></A>
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
[email protected]
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders