If I understand you correctly you want to trace "index.html"?
One funky way is...
trace(new XML("<a href='index.html'>Home</a>")....@href);
// traces "index.html"
...therefore if your e.currentTarget.getChildAt(0).htmlText is giving
you "<a href='index.html'>Home</a>" you can do:
trace(new XML(e.currentTarget.getChildAt(0).htmlText)....@href);
Or you can use RegExp to extract the string without using XML.
But this is crazy, really ;)
You should not need to use getChildByName/getChildAt at all for this.
Just extend Sprite and create public property, so that you can for
example just do
trace(e.target.href);
Kenneth Kawamoto
http://www.materiaprima.co.uk/
Susan Day wrote:
On Wed, Mar 10, 2010 at 2:20 PM, Susan Day <[email protected]>wrote:
On Wed, Mar 10, 2010 at 1:21 PM, [email protected] <
[email protected]> wrote:
If you trace e.currentTarget what do you get?
[object Sprite]
1
The "1" is from this line, which follows:
trace(e.currentTarget.numChildren);
So lo and behold, apparently currentTarget does indeed have a child (I'm
vindicated!).
So I changed the line which used getChildByName to getChildAt and entered
the value "0" and now all works well. But why didn't getChildByName work?
How can I find the name of the child?
Well, correction. getChildAt(0).htmlText gives me, of course, the full html
text:
<a href='index.html'>Home</a>
which, obviously, is not what I want. I tried to change htmlText to just the
link, but of course that screwed up the display of the name of the nav
widget (which should be "Home" not the whole blooming link). So I tried to
cheat and use the "name" property and assign the url to it, but it didn't
assign and chose its own name. What do?
TIA,
Susan
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders