Reply LinkBack Thread Tools Search this Thread
Old 17-04-2008, 14:35   #1 (permalink)
dtrenz
blam blam
 
dtrenz's Avatar
 
Join Date: Aug 2006
Location: ann arbor, mi usa
Posts: 522
AS3: Can you assign a variable/method by reference? (i.e. $a =& $b in PHP)

Can you assign a function to a method by reference in AS3?

Code:
nsClient.onPlayStatus = onPlayStatusHandlerFunction;

Is this possible?

In PHP you wuold use "=&" but I can't find anything like this in the AS3 docs.
  Reply With Quote
Old 17-04-2008, 15:48   #2 (permalink)
flatcat
beauty through chaos
 
flatcat's Avatar
 
Join Date: Jul 2003
Location: Vancouver, British Columbia
Posts: 726
Yeah.... there's no special assignment character though, it's just an equal sign. I can't remember if it would be:

Code:
nsClient.onPlayStatus = onPlayStatusHandlerFunction;

or

Code:
nsClient.onPlayStatus = onPlayStatusHandlerFunction();

And then to call it I believe it would be:

Code:
nsClient.onPlayStatus();


So it's actually assigning a function reference to a variable, not a method. Method would pertain to having it's own code since... well... it's a method.
__________________
audentes fortuna iuvat
Flatcat
  Reply With Quote
Old 17-04-2008, 16:44   #3 (permalink)
dtrenz
blam blam
 
dtrenz's Avatar
 
Join Date: Aug 2006
Location: ann arbor, mi usa
Posts: 522
Thanks... i just didn't get all the parts working at once.


the correct answer was:

Code:
nsClient.onPlayStatus = onPlayStatusHandler(info);
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8