A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Calling a function from an html link and passing multiple parameters

  1. #1
    Pillow Daddy m_andrews808's Avatar
    Join Date
    May 2001
    Location
    London England
    Posts
    924
    Hi all

    Okay I know how to call a function using an html link like this:

    Code:
    <a href="asfunction:_root.DoThis,Parameter">Click here</a>
    my problem is I need to pass in several parameters but when I do this:

    Code:
    <a href="asfunction:_root.DoThis,Parameter1,Parameter2,Parameter3">Click here</a>
    it passes one parameter with this value:

    'Parameter1,Parameter2,Parameter3'

    Does anyone know how I get round this?

    Thanks in advance

  2. #2
    Senior Member
    Join Date
    Jun 2001
    Posts
    199
    try passing an array instead of individual variables.

  3. #3
    Pillow Daddy m_andrews808's Avatar
    Join Date
    May 2001
    Location
    London England
    Posts
    924
    Can't do that because the link is in a text file.
    I can make some code to split the parameter up into many, but I want to know if there is an easier way of doing it.

    Any other suggestions?

  4. #4
    Senior Member
    Join Date
    Jul 2002
    Posts
    461
    you can split the arguments using string.split on the arguments array.
    eg:

    function DoThis () {
    trace ("arguments[0] = "+arguments[0])
    argsSplit=arguments[0].split(",")
    j=0;
    while(j<argsSplit.length){
    trace ("argsSplit"+j+"= " +argsSplit[j]);
    j++
    }
    }

    txt='<a href="asfunction:_root.DoThis,Parameter1,Parameter 2,Parameter3">Click here</a>'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center