Re: [Flashcoders] Passing Call To Child

2010-03-15 Thread Susan Day
On Sat, Mar 13, 2010 at 7:02 PM, David Hunter davehunte...@hotmail.comwrote:


 why are you creating more nav's when you mouseover or click an instance of
 nav? that seems unnecessary and quite possibly the source of the problem.


It isn't the source of the problem, but perhaps you could help me understand
what you mean and what I should do to make the code cleaner.


 i might be wrong but are you using it to try and change the color of the
 button? if so this should be done a different way.
 so i notice with this that when you first create the menu you pass
 Contact.html but in the rollover and click functions you only pass
 Contact.


THAT was the problem. Thank you!


 hope i've helped!


Indeed you have. Thank you!
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-15 Thread Susan Day
On Sat, Mar 13, 2010 at 10:47 PM, Keith Reinfeld
keithreinf...@comcast.netwrote:

 This would be the most straight forward means (given the context):

 private function onMouseOverHandler(e:MouseEvent):void{
e.currentTarget.getChildAt(0).backgroundColor = 0x97F9EC;
 }

 private function onMouseOutHandler(e:MouseEvent):void{
e.currentTarget.getChildAt(0).backgroundColor = 0x0E778A;
 }

 private function onPressHandler(e:MouseEvent):void{
e.currentTarget.getChildAt(0).backgroundColor = 0xFF;
 }

 private function onMouseUpHandler(e:MouseEvent):void{
e.currentTarget.getChildAt(0).backgroundColor = 0x0E778A;
// Navigate.to(e.currentTarget.linkURL);
 }


Thank you for helping me learn how this is done. That worked well with a few
minor modifications.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-15 Thread Mattheis, Erik (MIN - WSW)
   Navigation(' Home ', 'index', 235, 0x97f9ec); // What does this do? Please 
post function.

_ _ _
Erik Mattheis
Senior Web Developer
Minneapolis
T  952 346 6610
C 612 377 2272

Weber Shandwick
Advocacy starts here.

PRWeek Global Agency Report Card 2009 - Gold Medal Winner
The Holmes Report Global Agency of the Year
PR News Agency of the Year


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Susan Day
Sent: Saturday, March 13, 2010 9:03 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Passing Call To Child

On Sat, Mar 13, 2010 at 10:36 AM, David Hunter davehunte...@hotmail.comwrote:


 hi susan. you can paste this directly into a new FLA and it should work. it
 works for me: http://pastebin.org/111702
 i've passed it two parameters one for the actual url to navigate to and one
 without the http://...; junk for display in the textfield. but you could
 add or remove the http... stuff at different parts of the process if you
 only wanted to pass it one parameter but you might into problems later down
 the line with urls that use www and urls that don't let alone what is
 appended to the back .com,.co.uk,.biz,.info etc. i don't know
 where you are getting the urls from but if you are storing them in an array
 then you could just pass a number and grab the value from the array. you can
 always add extra parameters for x and y or any other attributes. there are
 many ways to skin a cat.
 hope i've helped,
 david


Thank you, however, I don't think this addresses my problem. My problem is
that I have an onMouseOver eventHandler that's running interference with the
onClick eventHandler. For some reason I can't figure out, that mouse-over
one mangles the on-click one. Here's the code for the mouse-over, and it's
pretty benign:

function onMouseOverHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN,
onMouseOverHandler);
e.currentTarget.removeEventListener(MouseEvent.CLICK,
onPressHandler);
Navigation(' Home ', 'index', 235, 0x97f9ec);
...

I added the removeEventListeners to try and resolve the problem, but that
didn't help. Here's the code for the other one:

function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
Navigation(' Home ', 'index', 235, 0xff);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER,
onMouseOverHandler);
Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
...

I shouldn't have to add that .html...that's what gets mangled. The rest of
the url is fine, underscores and all (where applicable), so it's not just a
duplication of the name property. I can't figure the silly thing out. Are
there other examples of where one event handler can mangle another?
TIA,
Susan
___
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] Passing Call To Child

2010-03-13 Thread David Benman

I found this script which shows the mouse event propagation in a movie:

http://www.bigspaceship.com/blog/labs/snaring-mouseenabled/

It has really helped me determine when I think events are going astray.

On Mar 12, 2010, at 8:09 AM, Susan Day wrote:

On Fri, Mar 12, 2010 at 8:48 AM, Susan Day  
suzieprogram...@gmail.comwrote:



On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW) 
ematth...@webershandwick.com wrote:

The missing .html thing has to be a simple mistake you're not  
seeing.



I realized you must be right. So I pulled out the pertinent code  
and have
built a test case. Sure enough, it's working properly. Now I'll  
figure out

what was breaking it.



The problem appears to be that when I mouse over a nav widget it  
activates a
fn called onMouseOver. When I comment out that addEventListener,  
then the fn

onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously  
I need
to add something to the onMouseOver fn, but what? Right now all I do  
is
re-call the nav fn to change the color of the btn. I tried this with  
no

luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN,  
onMouseOver);


TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


David Benman
Interactive Developer
d...@dbenman.com
http://www.dbenman.com
(508) 954-1202 (cell)
(315) 637-8487 (home office)



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-13 Thread Susan Day
On Sat, Mar 13, 2010 at 6:20 AM, David Benman d...@dbenman.com wrote:

 I found this script which shows the mouse event propagation in a movie:

 http://www.bigspaceship.com/blog/labs/snaring-mouseenabled/

 It has really helped me determine when I think events are going astray.


I'm studying your tutorials and thank you. However, I don't think they apply
to this *particular* situation (they certainly will have many applications
in the future), because tracing, as Anthony Pace suggested, the name
property of target and currentTarget yields the same result, as I expected,
because, if I understand correctly, in this case the object to which I
applied the eventListener is the same as the one that triggered the event,
since the eventListener is within the fn that defines the actions, variables
and properties. In other words, I'm no further ahead in answering my
question :(
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-13 Thread Paul Andrews

On 12/03/2010 19:48, Anthony Pace wrote:

agreed, cause:
MouseEvent.ROLL_OVER, MouseEvent.ROLL_OUT, and mouseChildren set to 
false makes it so both target and currentTarget return the object the 
listener was applied to.


Unfortunately the OP has a rollover handler but not in response to a 
ROLL_OVER event..


I must stop reading this thread - it sucks the life out of people.




On 3/12/2010 2:32 PM, Paul Andrews wrote:

On 12/03/2010 19:13, Anthony Pace wrote:

I am wondering if you know when to use currentTarget vs target


There's even more confusion about what a MouseOver is..




e.currentTarget is the object that you applied the eventListener to
e.target is the object that fired the event.

and if you are looking to get the child, then make sure not set 
mouseChildren to false.


e.g.  try using this to test what object is actually being targeted.

trace(e.currentTarget.name + is the variable name of the object you 
applied the listener too.);
trace(e.currentTarget + is the symbol instance name of the object 
you applied the listener too.);

//
trace(e.target.name + is the variable name of the object that fired 
the event);
trace(e.target + is the symbol instance name of the object that 
fired the event);


On 3/12/2010 8:09 AM, Susan Day wrote:
On Fri, Mar 12, 2010 at 8:48 AM, Susan 
Daysuzieprogram...@gmail.comwrote:



On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW)
ematth...@webershandwick.com  wrote:

The missing .html thing has to be a simple mistake you're not 
seeing.


I realized you must be right. So I pulled out the pertinent code 
and have
built a test case. Sure enough, it's working properly. Now I'll 
figure out

what was breaking it.

The problem appears to be that when I mouse over a nav widget it 
activates a
fn called onMouseOver. When I comment out that addEventListener, 
then the fn

onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? 
Obviously I need
to add something to the onMouseOver fn, but what? Right now all I 
do is
re-call the nav fn to change the color of the btn. I tried this 
with no

luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, 
onMouseOver);


TIA,
Susan
___


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread David Hunter

hi susan. you can paste this directly into a new FLA and it should work. it 
works for me: http://pastebin.org/111702 
i've passed it two parameters one for the actual url to navigate to and one 
without the http://...; junk for display in the textfield. but you could add 
or remove the http... stuff at different parts of the process if you only 
wanted to pass it one parameter but you might into problems later down the line 
with urls that use www and urls that don't let alone what is appended to the 
back .com,.co.uk,.biz,.info etc. i don't know where you are getting the 
urls from but if you are storing them in an array then you could just pass a 
number and grab the value from the array. you can always add extra parameters 
for x and y or any other attributes. there are many ways to skin a cat.
hope i've helped,
david

 Date: Sat, 13 Mar 2010 09:36:18 -0400
 Subject: Re: [Flashcoders] Passing Call To Child
 From: suzieprogram...@gmail.com
 To: flashcoders@chattyfig.figleaf.com
 
 On Sat, Mar 13, 2010 at 6:20 AM, David Benman d...@dbenman.com wrote:
 
  I found this script which shows the mouse event propagation in a movie:
 
  http://www.bigspaceship.com/blog/labs/snaring-mouseenabled/
 
  It has really helped me determine when I think events are going astray.
 
 
 I'm studying your tutorials and thank you. However, I don't think they apply
 to this *particular* situation (they certainly will have many applications
 in the future), because tracing, as Anthony Pace suggested, the name
 property of target and currentTarget yields the same result, as I expected,
 because, if I understand correctly, in this case the object to which I
 applied the eventListener is the same as the one that triggered the event,
 since the eventListener is within the fn that defines the actions, variables
 and properties. In other words, I'm no further ahead in answering my
 question :(
 TIA,
 Susan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
_
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-13 Thread Susan Day
On Sat, Mar 13, 2010 at 10:36 AM, David Hunter davehunte...@hotmail.comwrote:


 hi susan. you can paste this directly into a new FLA and it should work. it
 works for me: http://pastebin.org/111702
 i've passed it two parameters one for the actual url to navigate to and one
 without the http://...; junk for display in the textfield. but you could
 add or remove the http... stuff at different parts of the process if you
 only wanted to pass it one parameter but you might into problems later down
 the line with urls that use www and urls that don't let alone what is
 appended to the back .com,.co.uk,.biz,.info etc. i don't know
 where you are getting the urls from but if you are storing them in an array
 then you could just pass a number and grab the value from the array. you can
 always add extra parameters for x and y or any other attributes. there are
 many ways to skin a cat.
 hope i've helped,
 david


Thank you, however, I don't think this addresses my problem. My problem is
that I have an onMouseOver eventHandler that's running interference with the
onClick eventHandler. For some reason I can't figure out, that mouse-over
one mangles the on-click one. Here's the code for the mouse-over, and it's
pretty benign:

function onMouseOverHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN,
onMouseOverHandler);
e.currentTarget.removeEventListener(MouseEvent.CLICK,
onPressHandler);
Navigation(' Home ', 'index', 235, 0x97f9ec);
...

I added the removeEventListeners to try and resolve the problem, but that
didn't help. Here's the code for the other one:

function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
Navigation(' Home ', 'index', 235, 0xff);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER,
onMouseOverHandler);
Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
...

I shouldn't have to add that .html...that's what gets mangled. The rest of
the url is fine, underscores and all (where applicable), so it's not just a
duplication of the name property. I can't figure the silly thing out. Are
there other examples of where one event handler can mangle another?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread David Hunter

why are you removing the click handler when you roll over surely when you click 
it won't work?  and why are you testing for Home? what is Navigation doing? 
how are you generating the item you are clicking and how are you assigning the 
eventlisteners to it? fetching the text out of a child textfield seems 
unnecessary when you could use a property or instance variable (i think thats 
what they're called in OO) of the actual target.i'm not saying any of the code 
is wrong but without seeing what Navigation does etc we won't know what's 
causing the problem. can you make a really stripped down program that can be 
pasted straight into an FLA and tested. put it on pastebin.org
thanks,
david

 Date: Sat, 13 Mar 2010 11:02:44 -0400
 Subject: Re: [Flashcoders] Passing Call To Child
 From: suzieprogram...@gmail.com
 To: flashcoders@chattyfig.figleaf.com
 
 On Sat, Mar 13, 2010 at 10:36 AM, David Hunter 
 davehunte...@hotmail.comwrote:
 
 
  hi susan. you can paste this directly into a new FLA and it should work. it
  works for me: http://pastebin.org/111702
  i've passed it two parameters one for the actual url to navigate to and one
  without the http://...; junk for display in the textfield. but you could
  add or remove the http... stuff at different parts of the process if you
  only wanted to pass it one parameter but you might into problems later down
  the line with urls that use www and urls that don't let alone what is
  appended to the back .com,.co.uk,.biz,.info etc. i don't know
  where you are getting the urls from but if you are storing them in an array
  then you could just pass a number and grab the value from the array. you can
  always add extra parameters for x and y or any other attributes. there are
  many ways to skin a cat.
  hope i've helped,
  david
 
 
 Thank you, however, I don't think this addresses my problem. My problem is
 that I have an onMouseOver eventHandler that's running interference with the
 onClick eventHandler. For some reason I can't figure out, that mouse-over
 one mangles the on-click one. Here's the code for the mouse-over, and it's
 pretty benign:
 
 function onMouseOverHandler(e:MouseEvent)
 {
 if (e.currentTarget.name == ' Home ')
 {
 e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN,
 onMouseOverHandler);
 e.currentTarget.removeEventListener(MouseEvent.CLICK,
 onPressHandler);
 Navigation(' Home ', 'index', 235, 0x97f9ec);
 ...
 
 I added the removeEventListeners to try and resolve the problem, but that
 didn't help. Here's the code for the other one:
 
 function onPressHandler(e:MouseEvent)
 {
 if (e.currentTarget.name == ' Home ')
 {
 Navigation(' Home ', 'index', 235, 0xff);
 e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER,
 onMouseOverHandler);
 Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
 ...
 
 I shouldn't have to add that .html...that's what gets mangled. The rest of
 the url is fine, underscores and all (where applicable), so it's not just a
 duplication of the name property. I can't figure the silly thing out. Are
 there other examples of where one event handler can mangle another?
 TIA,
 Susan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
_
Tell us your greatest, weirdest and funniest Hotmail stories
http://clk.atdmt.com/UKM/go/195013117/direct/01/___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-13 Thread Odie Bracy
In the code below--

it looks like in the first function you have MouseEvent.MOUSE_DOWN associated 
with the onMouseOverHandler and in the second function you have 
Mouse.Event.MOUSE_OVER associated with the same handler.


Odie

On Mar 13, 2010, at 10:02 AM, Susan Day wrote:

 On Sat, Mar 13, 2010 at 10:36 AM, David Hunter 
 davehunte...@hotmail.comwrote:
 
 
 hi susan. you can paste this directly into a new FLA and it should work. it
 works for me: http://pastebin.org/111702
 i've passed it two parameters one for the actual url to navigate to and one
 without the http://...; junk for display in the textfield. but you could
 add or remove the http... stuff at different parts of the process if you
 only wanted to pass it one parameter but you might into problems later down
 the line with urls that use www and urls that don't let alone what is
 appended to the back .com,.co.uk,.biz,.info etc. i don't know
 where you are getting the urls from but if you are storing them in an array
 then you could just pass a number and grab the value from the array. you can
 always add extra parameters for x and y or any other attributes. there are
 many ways to skin a cat.
 hope i've helped,
 david
 
 
 Thank you, however, I don't think this addresses my problem. My problem is
 that I have an onMouseOver eventHandler that's running interference with the
 onClick eventHandler. For some reason I can't figure out, that mouse-over
 one mangles the on-click one. Here's the code for the mouse-over, and it's
 pretty benign:
 
function onMouseOverHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN,
 onMouseOverHandler);
e.currentTarget.removeEventListener(MouseEvent.CLICK,
 onPressHandler);
Navigation(' Home ', 'index', 235, 0x97f9ec);
 ...
 
 I added the removeEventListeners to try and resolve the problem, but that
 didn't help. Here's the code for the other one:
 
function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
Navigation(' Home ', 'index', 235, 0xff);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER,
 onMouseOverHandler);
Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
 ...
 
 I shouldn't have to add that .html...that's what gets mangled. The rest of
 the url is fine, underscores and all (where applicable), so it's not just a
 duplication of the name property. I can't figure the silly thing out. Are
 there other examples of where one event handler can mangle another?
 TIA,
 Susan
 ___
 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] Passing Call To Child

2010-03-13 Thread Susan Day
On Sat, Mar 13, 2010 at 11:31 AM, David Hunter davehunte...@hotmail.comwrote:


 why are you removing the click handler when you roll over surely when you
 click it won't work?


I was just testing. It doesn't work with or without that line, so it's a
mute point.


  and why are you testing for Home?


Right now I've hard coded the nav elts since I don't yet know how to iterate
through them. That's next ;)


 what is Navigation doing?


It's a script that writes the url. It works fine.


 how are you generating the item you are clicking and how are you assigning
 the eventlisteners to it?we won't know what's causing the problem. can you
 make a really stripped down program that can be pasted straight into an FLA
 and tested. put it on pastebin.org


Hey, that pastebin's pretty cool!
http://pastebin.org/111743
BTW, any suggestions as to how to iterate through what I've hard coded on
the event handler functions would be appreciated too ;)
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-13 Thread Susan Day
On Sat, Mar 13, 2010 at 10:22 AM, Paul Andrews p...@ipauland.com wrote:

 On 12/03/2010 19:48, Anthony Pace wrote:

 agreed, cause:
 MouseEvent.ROLL_OVER, MouseEvent.ROLL_OUT, and mouseChildren set to false
 makes it so both target and currentTarget return the object the listener was
 applied to.


 Unfortunately the OP has a rollover handler but not in response to a
 ROLL_OVER event..


Changing it does nothing. I probably should have eliminated those
removeEventListeners entirely. They do nothing at all.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread David Hunter

why are you creating more nav's when you mouseover or click an instance of nav? 
that seems unnecessary and quite possibly the source of the problem. i might be 
wrong but are you using it to try and change the color of the button? if so 
this should be done a different way.
so i notice with this that when you first create the menu you pass 
Contact.html but in the rollover and click functions you only pass Contact. 
as you are also passing the same myX value (782) that the new instance of nav 
will overlay the old one. so when you rollover a new instance with only 
Contact is created and then when you click it instead clicks the new instance 
without the .html bit and so that is why you are having to add it into the 
Navigate.to . 
i would remove all the conditionals and all the code adding nav's. just have a 
simple trace for the mouseover and not worry about changing the button color. 
you can add that once opening links works properly. i don't think you need to 
iterate through them in the mouseover or click behaviours but for iterating 
through a list of buttons you could store them in an array and loop through 
that using a 'for' loop or add them as children to a container sprite/movieclip 
and loop through its children again with a 'for' loop.
hope i've helped!
david

 Date: Sat, 13 Mar 2010 12:14:13 -0400
 Subject: Re: [Flashcoders] Passing Call To Child
 From: suzieprogram...@gmail.com
 To: flashcoders@chattyfig.figleaf.com
 
 On Sat, Mar 13, 2010 at 11:31 AM, David Hunter 
 davehunte...@hotmail.comwrote:
 
 
  why are you removing the click handler when you roll over surely when you
  click it won't work?
 
 
 I was just testing. It doesn't work with or without that line, so it's a
 mute point.
 
 
   and why are you testing for Home?
 
 
 Right now I've hard coded the nav elts since I don't yet know how to iterate
 through them. That's next ;)
 
 
  what is Navigation doing?
 
 
 It's a script that writes the url. It works fine.
 
 
  how are you generating the item you are clicking and how are you assigning
  the eventlisteners to it?we won't know what's causing the problem. can you
  make a really stripped down program that can be pasted straight into an FLA
  and tested. put it on pastebin.org
 
 
 Hey, that pastebin's pretty cool!
 http://pastebin.org/111743
 BTW, any suggestions as to how to iterate through what I've hard coded on
 the event handler functions would be appreciated too ;)
 TIA,
 Susan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
_
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread David Hunter

ok i've modified the stuff you put on pastebin and i think its working. (( i'm 
learning OOP at the mo so i'm a little shaky on some stuff )) . i've rewritten 
as little as possible of your test class (which i renamed Test2), just the 
mouseover and mousedown actions and changed the nsprite to a movieclip, as i 
don't have a URLClip class. i've also written a navigateToURL as i don't have 
Navigate class either. but you shouldn't need to add any extra .html with 
that function now.. http://pastebin.org/112001 . now to change the color of the 
button, you could redraw the child sprite which has the color, or change the 
textformat of some text, or maybe use colortransform, or create multiple 
versions of the same thing (like three rectangles each with a different color) 
and toggle their visibility, or use a tween engine to change something's color.
hope i've helped,
david

 Date: Sat, 13 Mar 2010 13:49:58 -0400
 Subject: Re: [Flashcoders] Passing Call To Child
 From: suzieprogram...@gmail.com
 To: flashcoders@chattyfig.figleaf.com
 
 On Sat, Mar 13, 2010 at 10:22 AM, Paul Andrews p...@ipauland.com wrote:
 
  On 12/03/2010 19:48, Anthony Pace wrote:
 
  agreed, cause:
  MouseEvent.ROLL_OVER, MouseEvent.ROLL_OUT, and mouseChildren set to false
  makes it so both target and currentTarget return the object the listener 
  was
  applied to.
 
 
  Unfortunately the OP has a rollover handler but not in response to a
  ROLL_OVER event..
 
 
 Changing it does nothing. I probably should have eliminated those
 removeEventListeners entirely. They do nothing at all.
 Susan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
_
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread Keith Reinfeld
I think Susan has gone back to the boat with Victor.
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-13 Thread Keith Reinfeld
 now to change the color of the button, you
 could redraw the child sprite which has the color, or change the
 textformat of some text, or maybe use colortransform, or create
 multiple versions of the same thing (like three rectangles each with a
 different color) and toggle their visibility, or use a tween engine to
 change something's color. 

David, 
This would be the most straight forward means (given the context): 

private function onMouseOverHandler(e:MouseEvent):void{ 
e.currentTarget.getChildAt(0).backgroundColor = 0x97F9EC; 
} 
 
private function onMouseOutHandler(e:MouseEvent):void{ 
e.currentTarget.getChildAt(0).backgroundColor = 0x0E778A; 
} 
 
private function onPressHandler(e:MouseEvent):void{ 
e.currentTarget.getChildAt(0).backgroundColor = 0xFF; 
} 
 
private function onMouseUpHandler(e:MouseEvent):void{ 
e.currentTarget.getChildAt(0).backgroundColor = 0x0E778A; 
// Navigate.to(e.currentTarget.linkURL); 
} 
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-12 Thread Susan Day
On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW) 
ematth...@webershandwick.com wrote:

 The missing .html thing has to be a simple mistake you're not seeing.


I realized you must be right. So I pulled out the pertinent code and have
built a test case. Sure enough, it's working properly. Now I'll figure out
what was breaking it.
Thanks,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-12 Thread Susan Day
On Fri, Mar 12, 2010 at 8:48 AM, Susan Day suzieprogram...@gmail.comwrote:

 On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW) 
 ematth...@webershandwick.com wrote:

 The missing .html thing has to be a simple mistake you're not seeing.


 I realized you must be right. So I pulled out the pertinent code and have
 built a test case. Sure enough, it's working properly. Now I'll figure out
 what was breaking it.


The problem appears to be that when I mouse over a nav widget it activates a
fn called onMouseOver. When I comment out that addEventListener, then the fn
onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously I need
to add something to the onMouseOver fn, but what? Right now all I do is
re-call the nav fn to change the color of the btn. I tried this with no
luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseOver);

TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-12 Thread Anthony Pace

I am wondering if you know when to use currentTarget vs target

e.currentTarget is the object that you applied the eventListener to
e.target is the object that fired the event.

and if you are looking to get the child, then make sure not set 
mouseChildren to false.


e.g.  try using this to test what object is actually being targeted.

trace(e.currentTarget.name + is the variable name of the object you 
applied the listener too.);
trace(e.currentTarget + is the symbol instance name of the object you 
applied the listener too.);

//
trace(e.target.name + is the variable name of the object that fired the 
event);
trace(e.target + is the symbol instance name of the object that fired 
the event);


On 3/12/2010 8:09 AM, Susan Day wrote:

On Fri, Mar 12, 2010 at 8:48 AM, Susan Daysuzieprogram...@gmail.comwrote:

   

On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW)
ematth...@webershandwick.com  wrote:

 

The missing .html thing has to be a simple mistake you're not seeing.
   


I realized you must be right. So I pulled out the pertinent code and have
built a test case. Sure enough, it's working properly. Now I'll figure out
what was breaking it.

 

The problem appears to be that when I mouse over a nav widget it activates a
fn called onMouseOver. When I comment out that addEventListener, then the fn
onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously I need
to add something to the onMouseOver fn, but what? Right now all I do is
re-call the nav fn to change the color of the btn. I tried this with no
luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseOver);

TIA,
Susan
___
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] Passing Call To Child

2010-03-12 Thread Paul Andrews

On 12/03/2010 19:13, Anthony Pace wrote:

I am wondering if you know when to use currentTarget vs target


There's even more confusion about what a MouseOver is..




e.currentTarget is the object that you applied the eventListener to
e.target is the object that fired the event.

and if you are looking to get the child, then make sure not set 
mouseChildren to false.


e.g.  try using this to test what object is actually being targeted.

trace(e.currentTarget.name + is the variable name of the object you 
applied the listener too.);
trace(e.currentTarget + is the symbol instance name of the object you 
applied the listener too.);

//
trace(e.target.name + is the variable name of the object that fired 
the event);
trace(e.target + is the symbol instance name of the object that fired 
the event);


On 3/12/2010 8:09 AM, Susan Day wrote:
On Fri, Mar 12, 2010 at 8:48 AM, Susan 
Daysuzieprogram...@gmail.comwrote:



On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW)
ematth...@webershandwick.com  wrote:

The missing .html thing has to be a simple mistake you're not 
seeing.


I realized you must be right. So I pulled out the pertinent code and 
have
built a test case. Sure enough, it's working properly. Now I'll 
figure out

what was breaking it.

The problem appears to be that when I mouse over a nav widget it 
activates a
fn called onMouseOver. When I comment out that addEventListener, then 
the fn

onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously 
I need

to add something to the onMouseOver fn, but what? Right now all I do is
re-call the nav fn to change the color of the btn. I tried this with no
luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseOver);

TIA,
Susan
___
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



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-12 Thread Anthony Pace

agreed, cause:
MouseEvent.ROLL_OVER, MouseEvent.ROLL_OUT, and mouseChildren set to 
false makes it so both target and currentTarget return the object the 
listener was applied to.



On 3/12/2010 2:32 PM, Paul Andrews wrote:

On 12/03/2010 19:13, Anthony Pace wrote:

I am wondering if you know when to use currentTarget vs target


There's even more confusion about what a MouseOver is..




e.currentTarget is the object that you applied the eventListener to
e.target is the object that fired the event.

and if you are looking to get the child, then make sure not set 
mouseChildren to false.


e.g.  try using this to test what object is actually being targeted.

trace(e.currentTarget.name + is the variable name of the object you 
applied the listener too.);
trace(e.currentTarget + is the symbol instance name of the object 
you applied the listener too.);

//
trace(e.target.name + is the variable name of the object that fired 
the event);
trace(e.target + is the symbol instance name of the object that 
fired the event);


On 3/12/2010 8:09 AM, Susan Day wrote:
On Fri, Mar 12, 2010 at 8:48 AM, Susan 
Daysuzieprogram...@gmail.comwrote:



On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW)
ematth...@webershandwick.com  wrote:

The missing .html thing has to be a simple mistake you're not 
seeing.


I realized you must be right. So I pulled out the pertinent code 
and have
built a test case. Sure enough, it's working properly. Now I'll 
figure out

what was breaking it.

The problem appears to be that when I mouse over a nav widget it 
activates a
fn called onMouseOver. When I comment out that addEventListener, 
then the fn

onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously 
I need

to add something to the onMouseOver fn, but what? Right now all I do is
re-call the nav fn to change the color of the btn. I tried this with no
luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, 
onMouseOver);


TIA,
Susan
___
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



___
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] Passing Call To Child

2010-03-12 Thread Anthony Pace
I just did a quick search on google for the differences better 
explained, and I came up with this:


http://www.wastedpotential.com/?p=10

After a quick glance, it seems like a nice tutorial.


On 3/12/2010 2:32 PM, Paul Andrews wrote:

On 12/03/2010 19:13, Anthony Pace wrote:

I am wondering if you know when to use currentTarget vs target


There's even more confusion about what a MouseOver is..




e.currentTarget is the object that you applied the eventListener to
e.target is the object that fired the event.

and if you are looking to get the child, then make sure not set 
mouseChildren to false.


e.g.  try using this to test what object is actually being targeted.

trace(e.currentTarget.name + is the variable name of the object you 
applied the listener too.);
trace(e.currentTarget + is the symbol instance name of the object 
you applied the listener too.);

//
trace(e.target.name + is the variable name of the object that fired 
the event);
trace(e.target + is the symbol instance name of the object that 
fired the event);


On 3/12/2010 8:09 AM, Susan Day wrote:
On Fri, Mar 12, 2010 at 8:48 AM, Susan 
Daysuzieprogram...@gmail.comwrote:



On Thu, Mar 11, 2010 at 3:55 PM, Mattheis, Erik (MIN - WSW)
ematth...@webershandwick.com  wrote:

The missing .html thing has to be a simple mistake you're not 
seeing.


I realized you must be right. So I pulled out the pertinent code 
and have
built a test case. Sure enough, it's working properly. Now I'll 
figure out

what was breaking it.

The problem appears to be that when I mouse over a nav widget it 
activates a
fn called onMouseOver. When I comment out that addEventListener, 
then the fn

onPressHandler for the onClick works as desired. So the onMouseOver is
running interference. How do I eliminate the interference? Obviously 
I need

to add something to the onMouseOver fn, but what? Right now all I do is
re-call the nav fn to change the color of the btn. I tried this with no
luck:

e.currentTarget.removeEventListener(MouseEvent.CLICK, onPressHandler);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, 
onMouseOver);


TIA,
Susan
___
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



___
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] Passing Call To Child

2010-03-11 Thread Susan Day
On Wed, Mar 10, 2010 at 7:07 PM, Kenneth Kawamoto kennethkawam...@gmail.com
 wrote:

 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);


I don't know where the heck that took me, something about go to this
address here or some such in the address bar of the browser lol. Yeah,
pretty out there and crazy. Definitely not elegant, but you knew that, too.

Karl DeSaulniers asks if I can give the Sprite/MC a name and call that. I've
tried that and I don't get the results I want; namely, an URL.

Paul Andrews asks me to state more clearly that for which I am looking.
Probably a good idea to re-clarify things.
1) I have a TextField (TF) to which I assign attributes.
2) TF is the child of an MC
3) The MC has listeners which call functions
4) One of the functions (onClick) requires that a new Web page be opened;
therefore, either:
 a) I attach and call the URL to/from the TF, or;
 b) I do so from the MC.
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 11:46, Susan Day wrote:

On Wed, Mar 10, 2010 at 7:07 PM, Kenneth Kawamotokennethkawam...@gmail.com
   

wrote:
 
   

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);

 

I don't know where the heck that took me, something about go to this
address here or some such in the address bar of the browser lol. Yeah,
pretty out there and crazy. Definitely not elegant, but you knew that, too.

Karl DeSaulniers asks if I can give the Sprite/MC a name and call that. I've
tried that and I don't get the results I want; namely, an URL.

Paul Andrews asks me to state more clearly that for which I am looking.
Probably a good idea to re-clarify things.
1) I have a TextField (TF) to which I assign attributes.
2) TF is the child of an MC
3) The MC has listeners which call functions
4) One of the functions (onClick) requires that a new Web page be opened;
therefore, either:
  a) I attach and call the URL to/from the TF, or;
  b) I do so from the MC.
TIA,
Susan
   

Susan,

I think your main confusion lies with the concept of attaching code 
and your clarification points to the URL being the content of the text 
field.


The natural place for your code is in the click handler.

The click handler knows which MC is involved, so it should be easily 
possible to access the URL text via the event property passed to the 
click handler.


Something like event.currentTarget.urlTextField.text

so in the click handler you need something like:

var pageURL:String = event.currentTarget.textField.text;

Then you can navigate. I'm not sure what you mean by attach.

Paul




___
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] Passing Call To Child

2010-03-11 Thread kennethkawam...@gmail.com
A bare-bones example of a navigation button you are after:

// NavigationButton class
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

public class NavigationButton extends Sprite {
public var href:String;
public var label:String;

public function NavigationButton(h:String, l:String):void {
href = h;
label = l;
init();
}

private function init():void {
mouseChildren = false;
var tf:TextField = new TextField();
with(tf){
autoSize = TextFieldAutoSize.LEFT;
text = label;
}
addChild(tf);
}
}
}
//

...then you create a NavigationButton instance from your document class:

//
 private function init():void {
   var navBtn:NavigationButton = new NavigationButton(index.html, Home);
   navBtn.addEventListener(MouseEvent.CLICK, navBtnClick);
   addChild(navBtn);
}

private function navBtnClick(e:MouseEvent):void {
   navigateToURL(new URLRequest(e.target.href));
}
//
-- 
Kenneth Kawamoto
http://www.materiaprima.co.uk/

On 11 March 2010 11:46, Susan Day suzieprogram...@gmail.com wrote:
 On Wed, Mar 10, 2010 at 7:07 PM, Kenneth Kawamoto
 kennethkawam...@gmail.com wrote:

 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);

 I don't know where the heck that took me, something about go to this
 address here or some such in the address bar of the browser lol. Yeah,
 pretty out there and crazy. Definitely not elegant, but you knew that, too.
 Karl DeSaulniers asks if I can give the Sprite/MC a name and call that. I've
 tried that and I don't get the results I want; namely, an URL.
 Paul Andrews asks me to state more clearly that for which I am looking.
 Probably a good idea to re-clarify things.
 1) I have a TextField (TF) to which I assign attributes.
 2) TF is the child of an MC
 3) The MC has listeners which call functions
 4) One of the functions (onClick) requires that a new Web page be opened;
 therefore, either:
      a) I attach and call the URL to/from the TF, or;
      b) I do so from the MC.
 TIA,
 Susan

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 8:01 AM, Paul Andrews p...@ipauland.com wrote:
Susan,


 I think your main confusion lies with the concept of attaching code and
 your clarification points to the URL being the content of the text field.

 The natural place for your code is in the click handler.

 The click handler knows which MC is involved, so it should be easily
 possible to access the URL text via the event property passed to the click
 handler.

 Something like event.currentTarget.urlTextField.text

 so in the click handler you need something like:

 var pageURL:String = event.currentTarget.textField.text;

 Then you can navigate. I'm not sure what you mean by attach.


So I added a new child (in addition to TF) to the MC specifically to handle
the URL. I gave this new child a text property of the URL that is passed
through to the function. Now:
1) When I trace the value of this URL within the function in which the child
is created and added to the MC, the correct value traces.
2) When I explicitly add the correct value (as opposed to passing it as a
parameter to said function, which again printed correctly on trace), the
correct value is passed and the link is indeed established in the
onMouseClick function. Of course, that won't work on automatic generation,
since that same value will be passed to all instances, which is contrary to
what I need.
3) **However**, when I call the property in the onMouseClick function when
the URL is passed through to the initial function, onMouseClick truncates
.html!!! The inelegant solution to this, of course, is to tag .html on
to that which is passed to the navigation function in the onMouseClick
function. Yuck. But hey, it works. Now the property which I use to attach
the URL to the newly created child is text. If I use htmlText, ugly
things happen (spits out all sorts of superfluous code).

OK, so it works. It's ugly, Any ideas on how to clean it up?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 12:37, Susan Day wrote:

On Thu, Mar 11, 2010 at 8:01 AM, Paul Andrewsp...@ipauland.com  wrote:
Susan,
   


I think your main confusion lies with the concept of attaching code and
your clarification points to the URL being the content of the text field.

The natural place for your code is in the click handler.

The click handler knows which MC is involved, so it should be easily
possible to access the URL text via the event property passed to the click
handler.

Something like event.currentTarget.urlTextField.text

so in the click handler you need something like:

var pageURL:String = event.currentTarget.textField.text;

Then you can navigate. I'm not sure what you mean by attach.

 

So I added a new child (in addition to TF) to the MC specifically to handle
the URL. I gave this new child a text property of the URL that is passed
through to the function. Now:
1) When I trace the value of this URL within the function in which the child
is created and added to the MC, the correct value traces.
2) When I explicitly add the correct value (as opposed to passing it as a
parameter to said function, which again printed correctly on trace), the
correct value is passed and the link is indeed established in the
onMouseClick function. Of course, that won't work on automatic generation,
since that same value will be passed to all instances, which is contrary to
what I need.
3) **However**, when I call the property in the onMouseClick function when
the URL is passed through to the initial function, onMouseClick truncates
.html!!! The inelegant solution to this, of course, is to tag .html on
to that which is passed to the navigation function in the onMouseClick
function. Yuck. But hey, it works. Now the property which I use to attach
the URL to the newly created child is text. If I use htmlText, ugly
things happen (spits out all sorts of superfluous code).

OK, so it works. It's ugly, Any ideas on how to clean it up?
   


I think another poster has supplied a more elegant solution. In truth 
your code becomes complicated as you seek to a void using classes.


A simple class solution would be to extend MovieClip (or Sprite)  and 
add a url string. This would allow you to stop messing about with children.


package {
import flash.display.Sprite;
public class URLClip extends Sprite{
public var url:String;
public function URLClip (){
// add your text fields here
}
}
}

Now you can set the url directly and access it later.

var newBtn:URLClip = new URLClip();
newBtn.url=http://goggle.com/;;


newBtn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e:Event):void{
trace(navigate to +e.currentTarget.url);
}

or something like that.


Paul




TIA,
Susan
___
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] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 9:25 AM, Paul Andrews p...@ipauland.com wrote:

 A simple class solution would be to extend MovieClip (or Sprite)  and add a
 url string. This would allow you to stop messing about with children.


 package {
import flash.display.Sprite;
public class URLClip extends Sprite{
public var url:String;
public function URLClip (){
// add your text fields here
}
}
 }

 Now you can set the url directly and access it later.

 var newBtn:URLClip = new URLClip();
 newBtn.url=http://goggle.com/;;


 newBtn.addEventListener(MouseEvent.CLICK, onClick);

 function onClick(e:Event):void{
trace(navigate to +e.currentTarget.url);
 }

 or something like that.


Gotcha. Yep, that's the way to do it.
Thanks,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 9:25 AM, Paul Andrews p...@ipauland.com wrote:

 function onClick(e:Event):void{
trace(navigate to +e.currentTarget.url);


The blasted thing traced the url without .html at the end...again!! What
could possibly be causing this behavior? When I trace Btn.url in the
function where it is created, it correctly traces with the .html tag. Why
on earth would it be stripped in the onMouseClick function?? Here's the
pertinent from that fn:

function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
Navigation(' Home ', 'index', 235, 0xff);
Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
trace(e.currentTarget.url);
...

Please advise.
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 13:53, Susan Day wrote:

On Thu, Mar 11, 2010 at 9:25 AM, Paul Andrewsp...@ipauland.com  wrote:

   

function onClick(e:Event):void{
trace(navigate to +e.currentTarget.url);

 

The blasted thing traced the url without .html at the end...again!! What
could possibly be causing this behavior? When I trace Btn.url in the
function where it is created, it correctly traces with the .html tag. Why
on earth would it be stripped in the onMouseClick function?? Here's the
pertinent from that fn:

function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ')
{
Navigation(' Home ', 'index', 235, 0xff);
Navigate.to(e.currentTarget.getChildAt(1).text + '.html');
trace(e.currentTarget.url);
   
The trace statement above doesn't have '.html' appended. You have 
inconveniently left off the assignment to the url string.


Susan, make a tiny example rather than give snippets.

In general, for an OO solution, code that says if (e.currentTarget.name 
== ' Home ')  to look for particular cases isn't very OO!


Also if you had code in your sprite class that said something like:

public var urlTextFld:TextField  ;

In the constructor ..
urlTextFld = new TextField() ..
addChild(urlTextFld);

You can then ditch guessing where on the display list for the target the 
textfield is  because it would then be


Navigate.to(e.currentTarget.urlTextFld.text + '.html');

Paul


...

Please advise.
TIA,
Susan
___
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] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 10:17 AM, Paul Andrews p...@ipauland.com wrote:

 The trace statement above doesn't have '.html' appended. You have
 inconveniently left off the assignment to the url string.


I believe I mentioned in an earlier post that when I print url in the
calling function, it prints the entire url, with .html. However, when I
print it in the called fn, it drops the .html. Is that not clear? Does
something else need clarification?


 Susan, make a tiny example rather than give snippets.


Not sure what you mean here. Complete code? If necessary, please let me
know.


 In general, for an OO solution, code that says if (e.currentTarget.name== ' 
 Home ')  to look for particular cases isn't very OO!


Well, that's the next question lol. But let's deal with this one first.


 Also if you had code in your sprite class that said something like:

 public var urlTextFld:TextField  ;

 In the constructor ..
 urlTextFld = new TextField() ..
 addChild(urlTextFld);


It says:

package
{
import flash.display.Sprite;
 public class URLClip extends Sprite
{
public var url:String;
public function URLClip ()
{
}
}
}

Exactly what a previous poster supplied. It's called thus:

nsprite.url = nurl;

where nsprite has the listener that calls the onClick fn and nurl is passed
as a var to the fn from which the above line is quoted.

I just don't understand why, when I trace nsprite.url in the calling fn, it
prints with .html, but when I call it in the listening fn (the onClick),
it drops it! Why would it do that?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 15:41, Susan Day wrote:

On Thu, Mar 11, 2010 at 10:17 AM, Paul Andrewsp...@ipauland.com  wrote:

   

The trace statement above doesn't have '.html' appended. You have
inconveniently left off the assignment to the url string.

 

I believe I mentioned in an earlier post that when I print url in the
calling function, it prints the entire url, with .html. However, when I
print it in the called fn, it drops the .html. Is that not clear? Does
something else need clarification?

   

Susan, make a tiny example rather than give snippets.

 

Not sure what you mean here. Complete code? If necessary, please let me
know.

   

In general, for an OO solution, code that says if (e.currentTarget.name== ' Home ') 
 to look for particular cases isn't very OO!

 

Well, that's the next question lol. But let's deal with this one first.

   

Also if you had code in your sprite class that said something like:

public var urlTextFld:TextField  ;

In the constructor ..
urlTextFld = new TextField() ..
addChild(urlTextFld);

 

It says:

package
{
import flash.display.Sprite;
  public class URLClip extends Sprite
{
public var url:String;
public function URLClip ()
{
}
}
}

Exactly what a previous poster supplied. It's called thus:

nsprite.url = nurl;

where nsprite has the listener that calls the onClick fn and nurl is passed
as a var to the fn from which the above line is quoted.

I just don't understand why, when I trace nsprite.url in the calling fn, it
prints with .html, but when I call it in the listening fn (the onClick),
it drops it! Why would it do that?
   


Because your code doesn't do what you think it does and we don't know 
what your code is really doing because we only know what you choose to 
tell us.


It's a bit like playing twenty questions.

Show us Navigate.to()


TIA,
Susan
___
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] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 12:02 PM, Paul Andrews p...@ipauland.com wrote:

 Show us Navigate.to()


Navigate was a script I copied and it works in other apps:

package
{
import flash.net.URLRequest;
import flash.net.navigateToURL;

public class Navigate{
public function Navigate(url:String, target:String) {
var URLReq:URLRequest = new URLRequest(url);
try {
navigateToURL(URLReq, target);
} catch (e:Error) {
trace(Navigate is broken =  + e);
}
}

public static function to(url:String, target:String =
_self):Navigate {
return new Navigate(url, target);
}
}
}

Does this help?
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 16:20, Susan Day wrote:

On Thu, Mar 11, 2010 at 12:02 PM, Paul Andrewsp...@ipauland.com  wrote:

   

Show us Navigate.to()

 

Navigate was a script I copied and it works in other apps:

package
{
 import flash.net.URLRequest;
 import flash.net.navigateToURL;

 public class Navigate{
 public function Navigate(url:String, target:String) {
 var URLReq:URLRequest = new URLRequest(url);
 try {
 navigateToURL(URLReq, target);
 } catch (e:Error) {
 trace(Navigate is broken =  + e);
 }
 }

 public static function to(url:String, target:String =
_self):Navigate {
 return new Navigate(url, target);
 }
 }
}

Does this help?
   
Well it shows that it has nothing to do with the .html being missing 
and nowhere have you shown where you assigned the string with .html added.


We are going around in circles.

Paul

Susan
___
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] Passing Call To Child

2010-03-11 Thread Merrill, Jason
 Please advise.

 We are going around in circles.


Smells a bit like beno in here.


Jason Merrill 

Bank of  America  Global Learning 
Learning  Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Susan Day
On Thu, Mar 11, 2010 at 1:23 PM, Paul Andrews p...@ipauland.com wrote:

 Well it shows that it has nothing to do with the .html being missing and
 nowhere have you shown where you assigned the string with .html added.


I believe I made it clear before that I assign the .html to the url. I
believe most urls end in html, py, php, asp, etc., and that most variables
with a url would be written like a url. I have mentioned previously that
this var prints out correctly in the fn in which it is defined and
incorrectly--specifying without the html--in the onClick fn. Yes, I believe
I've made this clear before. And I'm making it clear again. Why is it that
the assigning fn traces this var with the extension and that the onClick fn
doesn't??


 We are going around in circles.


I don't think that's my fault, sorry.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Paul Andrews

On 11/03/2010 17:57, Susan Day wrote:

On Thu, Mar 11, 2010 at 1:23 PM, Paul Andrewsp...@ipauland.com  wrote:

   

Well it shows that it has nothing to do with the .html being missing and
nowhere have you shown where you assigned the string with .html added.

 

I believe I made it clear before that I assign the .html to the url. I
believe most urls end in html, py, php, asp, etc., and that most variables
with a url would be written like a url. I have mentioned previously that
this var prints out correctly in the fn in which it is defined and
incorrectly--specifying without the html--in the onClick fn. Yes, I believe
I've made this clear before. And I'm making it clear again. Why is it that
the assigning fn traces this var with the extension and that the onClick fn
doesn't??

   

We are going around in circles.

 

I don't think that's my fault, sorry.
   


Cool, I'll just let you get on with it.


Susan
___
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] Passing Call To Child

2010-03-11 Thread Mattheis, Erik (MIN - WSW)
The missing .html thing has to be a simple mistake you're not seeing. Have 
you tried tracing the value at every point where it gets passed around?

_ _ _
Erik Mattheis
Senior Web Developer
Minneapolis
T  952 346 6610
C 612 377 2272

Weber Shandwick
Advocacy starts here.

PRWeek Global Agency Report Card 2009 - Gold Medal Winner
The Holmes Report Global Agency of the Year
PR News Agency of the Year

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-11 Thread Jim Lafser
You are holding onto the string reference created after addding the .html and 
not the reference to the object that doesn't have the .html, right?

--- On Thu, 3/11/10, Susan Day suzieprogram...@gmail.com wrote:


From: Susan Day suzieprogram...@gmail.com
Subject: Re: [Flashcoders] Passing Call To Child
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Date: Thursday, March 11, 2010, 12:57 PM


On Thu, Mar 11, 2010 at 1:23 PM, Paul Andrews p...@ipauland.com wrote:

 Well it shows that it has nothing to do with the .html being missing and
 nowhere have you shown where you assigned the string with .html added.


I believe I made it clear before that I assign the .html to the url. I
believe most urls end in html, py, php, asp, etc., and that most variables
with a url would be written like a url. I have mentioned previously that
this var prints out correctly in the fn in which it is defined and
incorrectly--specifying without the html--in the onClick fn. Yes, I believe
I've made this clear before. And I'm making it clear again. Why is it that
the assigning fn traces this var with the extension and that the onClick fn
doesn't??


 We are going around in circles.


I don't think that's my fault, sorry.
Susan
___
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


[Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
Hi;
I have this line of code that I need to fix:

myFunction(e.currentTarget[aChild].text);

That is, I need to target not e.currentTarget but the child of the same
(aChild). How do I do that?
TIA.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread kennethkawam...@gmail.com
If aChild is a public property of your currentTarget, your code would work.

If not you can use getChildByName()/getChildAt()
-- 
Kenneth Kawamoto
http://www.materiaprima.co.uk/

On 10 March 2010 12:05, Susan Day suzieprogram...@gmail.com wrote:
 Hi;
 I have this line of code that I need to fix:

 myFunction(e.currentTarget[aChild].text);

 That is, I need to target not e.currentTarget but the child of the same
 (aChild). How do I do that?
 TIA.
 Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 9:31 AM, kennethkawam...@gmail.com 
kennethkawam...@gmail.com wrote:

 If aChild is a public property of your currentTarget, your code would
 work.

 If not you can use getChildByName()/getChildAt()


It isn't, so I tried this code:

trace(e.currentTarget.getChildByName(aChild).text);

and while it didn't error, it didn't trace anything when I moused over :(
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 10:20 AM, Susan Day suzieprogram...@gmail.comwrote:

 On Wed, Mar 10, 2010 at 9:31 AM, kennethkawam...@gmail.com 
 kennethkawam...@gmail.com wrote:

 If aChild is a public property of your currentTarget, your code would
 work.

 If not you can use getChildByName()/getChildAt()


 It isn't, so I tried this code:

 trace(e.currentTarget.getChildByName(aChild).text);

 and while it didn't error, it didn't trace anything when I moused over :(


Oops. My bad. Moused over the wrong widget. It threw this error:

1009: Cannot access a property or method of a null object.

Now, aChild is generated anew with every iteration; however, it's obviously
bound to the currentTarget. Please advise.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Geografiek

Hi Susan,
The error means that 'e.currentTarget.getChildByName(aChild).text'  
dies not exist.
I think the syntax should read e.currentTarget.getChildByName 
(aChild).text (quotes around aChild as the name of an object is a  
string)

HTH
Willem van den Goorbergh

On 10-mrt-2010, at 15:22, Susan Day wrote:

On Wed, Mar 10, 2010 at 10:20 AM, Susan Day  
suzieprogram...@gmail.comwrote:



On Wed, Mar 10, 2010 at 9:31 AM, kennethkawam...@gmail.com 
kennethkawam...@gmail.com wrote:

If aChild is a public property of your currentTarget, your code  
would

work.

If not you can use getChildByName()/getChildAt()



It isn't, so I tried this code:

trace(e.currentTarget.getChildByName(aChild).text);

and while it didn't error, it didn't trace anything when I moused  
over :(




Oops. My bad. Moused over the wrong widget. It threw this error:

1009: Cannot access a property or method of a null object.

Now, aChild is generated anew with every iteration; however, it's  
obviously

bound to the currentTarget. Please advise.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31) 
30-2719512 or cell phone: (+31)6-26372378

or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 10:38 AM, Geografiek geograf...@geografiek.nlwrote:

 Hi Susan,
 The error means that 'e.currentTarget.getChildByName(aChild).text' dies not
 exist.


But it does too exist! Not fair! :(


 I think the syntax should read
 e.currentTarget.getChildByName(aChild).text (quotes around aChild as the
 name of an object is a string)


That made sense, but it still threw the same error. So I tried this:

trace(e.currentTarget.numChildren);

and that, too, threw the same error, collaborating with your evaluation.
However, I have these lines in the code that calls the function wherein the
trace is defined:

mySprite.addChild(aChild);
addChild(mySprite);

so clearly, mySprite, which is the currentTarget:

mySprite.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);

does indeed have a child. (This is beginning to remind me of certain
deadbeat fathers who divorce their wives and don't pay alimony lol.) What
do?
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Passing Call To Child

2010-03-10 Thread Merrill, Jason
 That is, I need to target not e.currentTarget but the child of the
same
(aChild). How do I do that?

Personally, I think this is the wrong approach.  Dispatch events with
event bubbling or a design pattern like MVC with events instead.  You
should not couple your code so tightly to parent/child relationships in
my opinion.  Continuing down the path of targeting children, parents,
grandparents, etc. will only bring headache and heartache for you and
anyone else who has to touch your code in the future.


Jason Merrill 

Bank of  America  Global Learning 
Learning  Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Geografiek

Yes I sent that to the wish list, to make AS4 fairer. ;-)
Did you try the quotes?
Willem

On 10-mrt-2010, at 15:58, Susan Day wrote:

On Wed, Mar 10, 2010 at 10:38 AM, Geografiek  
geograf...@geografiek.nlwrote:



Hi Susan,
The error means that 'e.currentTarget.getChildByName(aChild).text'  
dies not

exist.



But it does too exist! Not fair! :(



I think the syntax should read
e.currentTarget.getChildByName(aChild).text (quotes around  
aChild as the

name of an object is a string)



That made sense, but it still threw the same error. So I tried this:

trace(e.currentTarget.numChildren);

and that, too, threw the same error, collaborating with your  
evaluation.
However, I have these lines in the code that calls the function  
wherein the

trace is defined:

mySprite.addChild(aChild);
addChild(mySprite);

so clearly, mySprite, which is the currentTarget:

mySprite.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);

does indeed have a child. (This is beginning to remind me of certain
deadbeat fathers who divorce their wives and don't pay alimony  
lol.) What

do?
Susan
___
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] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 11:23 AM, Merrill, Jason 
jason.merr...@bankofamerica.com wrote:

  That is, I need to target not e.currentTarget but the child of the
 same
 (aChild). How do I do that?

 Personally, I think this is the wrong approach.  Dispatch events with
 event bubbling or a design pattern like MVC with events instead.  You
 should not couple your code so tightly to parent/child relationships in
 my opinion.  Continuing down the path of targeting children, parents,
 grandparents, etc. will only bring headache and heartache for you and
 anyone else who has to touch your code in the future.


Example?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 12:04 PM, Geografiek geograf...@geografiek.nlwrote:

 Yes I sent that to the wish list, to make AS4 fairer. ;-)
 Did you try the quotes?


Yes, to no avail :(
Other ideas?
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread kennethkawam...@gmail.com
If you trace e.currentTarget what do you get?
-- 
Kenneth Kawamoto
http://www.materiaprima.co.uk/

On 10 March 2010 14:58, Susan Day suzieprogram...@gmail.com wrote:
 On Wed, Mar 10, 2010 at 10:38 AM, Geografiek geograf...@geografiek.nlwrote:

 Hi Susan,
 The error means that 'e.currentTarget.getChildByName(aChild).text' dies not
 exist.


 But it does too exist! Not fair! :(


 I think the syntax should read
 e.currentTarget.getChildByName(aChild).text (quotes around aChild as the
 name of an object is a string)


 That made sense, but it still threw the same error. So I tried this:

 trace(e.currentTarget.numChildren);

 and that, too, threw the same error, collaborating with your evaluation.
 However, I have these lines in the code that calls the function wherein the
 trace is defined:

 mySprite.addChild(aChild);
 addChild(mySprite);

 so clearly, mySprite, which is the currentTarget:

 mySprite.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);

 does indeed have a child. (This is beginning to remind me of certain
 deadbeat fathers who divorce their wives and don't pay alimony lol.) What
 do?
 Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 1:21 PM, kennethkawam...@gmail.com 
kennethkawam...@gmail.com 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?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 2:20 PM, Susan Day suzieprogram...@gmail.comwrote:

 On Wed, Mar 10, 2010 at 1:21 PM, kennethkawam...@gmail.com 
 kennethkawam...@gmail.com 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Nathan Mynarcik
If you are putting the sprite in an MC and then doing mc.name = myName it 
should then return the name of the mc. Sprite however does not have the name 
property. 


--Original Message--
From: Susan Day
Sender: flashcoders-boun...@chattyfig.figleaf.com
To: Flash Coders List
ReplyTo: Flash Coders List
Subject: Re: [Flashcoders] Passing Call To Child
Sent: Mar 10, 2010 12:20 PM

On Wed, Mar 10, 2010 at 1:21 PM, kennethkawam...@gmail.com 
kennethkawam...@gmail.com 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?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Nathan Mynarcik
Interactive Web Developer
nat...@mynarcik.com
254.749.2525
www.mynarcik.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Susan Day
On Wed, Mar 10, 2010 at 2:32 PM, Nathan Mynarcik nat...@mynarcik.comwrote:

 If you are putting the sprite in an MC and then doing mc.name = myName
 it should then return the name of the mc. Sprite however does not have the
 name property.


The plot thickens. So I changed my Sprite to an MC and then I discovered I
could add a text or htmlText property to it. So I did and tried to use them
in my navigation function

e.currentTarget.htmlText

for example, now no need to call the child (so I thought). But it's
stubborn. No matter what value I assign to the text or htmlText, it wants to
give it the name property. Good grief. What up? Or can I somehow assign a
value to the child that will properly pass nothing but the url?
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Karl DeSaulniers
Can u give the text box a variable name and reference that instead of  
the .text or .htmlText value?


Karl

Sent from losPhone

On Mar 10, 2010, at 12:47 PM, Susan Day suzieprogram...@gmail.com  
wrote:


On Wed, Mar 10, 2010 at 2:32 PM, Nathan Mynarcik  
nat...@mynarcik.comwrote:


If you are putting the sprite in an MC and then doing mc.name =  
myName
it should then return the name of the mc. Sprite however does not  
have the

name property.



The plot thickens. So I changed my Sprite to an MC and then I  
discovered I
could add a text or htmlText property to it. So I did and tried to  
use them

in my navigation function

e.currentTarget.htmlText

for example, now no need to call the child (so I thought). But it's
stubborn. No matter what value I assign to the text or htmlText, it  
wants to
give it the name property. Good grief. What up? Or can I somehow  
assign a

value to the child that will properly pass nothing but the url?
TIA,
Susan
___
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] Passing Call To Child

2010-03-10 Thread Kenneth Kawamoto

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 suzieprogram...@gmail.comwrote:


On Wed, Mar 10, 2010 at 1:21 PM, kennethkawam...@gmail.com 
kennethkawam...@gmail.com 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Passing Call To Child

2010-03-10 Thread Paul Andrews

On 10/03/2010 12:05, Susan Day wrote:

Hi;
I have this line of code that I need to fix:

myFunction(e.currentTarget[aChild].text);

That is, I need to target not e.currentTarget but the child of the same
(aChild). How do I do that?
TIA.
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

   


Sue, I have glanced over the thread and it looks like you may be making 
something more complicated than it needs to be. It might be an idea to 
explain exactly what the problem is (and I don't mean at such a low 
level), then you might get a better answer than the ones to the 
questions that you are asking.


Paul
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders