Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

referencing internal functions from a text string

4 views
Skip to first unread message

Paul

unread,
Jul 10, 2001, 6:30:03 AM7/10/01
to
Does anybody know if its possible to call functions from a text string?
I know its possible to call external functions/web pages using a variable
string, via the HTML option, but what I'd really like to do is create
buttons without having to use a button object.
Does anyone understand what I mean?

Paul


perry perreiter

unread,
Jul 10, 2001, 9:32:16 AM7/10/01
to
if i get you right i悲 say it愀 not possible since the eval() function is
not as powerful as in javascript
perry
"Paul" <pa...@sixzeds.com> schrieb im Newsbeitrag
news:9iel8f$b52$1...@forums.macromedia.com...

Michael Peo

unread,
Jul 10, 2001, 9:32:48 AM7/10/01
to
it is possible, using the anchor-tag. The syntax goes like this:
<A HREF='asfunction:myFunctionName'>invoke the function</A>

If you wanna pass a parameter to the function, you would do it like this:
<A HREF='asfunction:myFunctionName,myParameter'>invoke the function</A>

Due to the fact that inside the invoked function the "myParameter" is
allways a string,
you have to use a delimiter if you wanna pass more than one parameter.
The fuction called will use the delimiter to split up the string into
seperate values.
Something like this:
<A HREF='asfunction:roleCall,Lisa|Bob'>invoke the function</A>

and then myFuntion would have to look something like:
function roleCall (name) {
var bothNames = name.split("|");
trace ("first name: " + bothNames[0]);
trace ("second name: " + bothNames[1]);
}

These examples a losly copied from the master himself Colin Moock, and his
book "Actionscripting: The Definitive Guide".
I strongly recommend visiting his site, read som of the free chapters, and
then buy the book.
http://www.moock.org/asdg/

Hope this helps you out
/peo
p...@bandage.dk
www.bandage.dk

"Paul" <pa...@sixzeds.com> wrote in message
news:9iel8f$b52$1...@forums.macromedia.com...

Paul

unread,
Jul 10, 2001, 10:37:08 AM7/10/01
to
thats bloody brilliant!! I thought it would be a bit stupid to href external
stuff without being able doing it internally as well.

thanks alot for that and thanks to Mr Moock.

Paul


Adam Burtch

unread,
Jul 10, 2001, 2:17:42 PM7/10/01
to

"Michael Peo" <p...@bandage.dk> wrote in message
news:9if03q$607$1...@forums.macromedia.com...

> I strongly recommend visiting his site, read som of the free chapters, and
> then buy the book.

I would totally second that. It will accelerate your understanding of AS,
especially the OOP end of things, immensely.

Sincerely,
Adam Burtch
Macromedia Tech Support

Mike Chambers

unread,
Jul 14, 2001, 7:05:24 PM7/14/01
to
Just remeber that this is undocumented for a reason, and that is that
it is a little buggy.

a lot of users report that using the asfunction command will crwash
their browsers.

another alternative is to store all of your functions in an
associative array, and then just call the array index by name that you
want to run.

you can do this because functions are treated similar to variables and
this you can store them in arrays.

here is some more info on this:

http://i-technica.com/flashlist/index.asp?n=1375

hope that helps...

mike chambers

me...@macromedia.com

On Tue, 10 Jul 2001 15:32:48 +0200, "Michael Peo" <p...@bandage.dk>
wrote:

0 new messages