A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Passing an instance name argument into a function

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    4

    resolved [RESOLVED] Passing an instance name argument into a function

    Hi guys, I'm kind of new to actionscript. I searched the forum and couldn't find anything on this and searched google as well and could not find an answer soo this is my first post here hope you can guys can help.

    Well I want to set up a function that will calculate the x position of where my MovieClip's instance name will go.

    Here is the code i currently have.


    function xBtnPosition(btnName: String, btnXpercentage: Number):String
    {
    var xFinalPosition: String = -(((btnName.width * btnXpercentage) / btnName.scaleY));
    return (xFinalPosition);
    }

    var storedResult: String = xBtnPosition(navigationbg_mc, .85);


    As you can see I pass the two arguments into my function but it says there is an error because it's a string, how do I make it so it's not a string and it can be used in the function? Help would be greatly appreciated! Thanks guy!

  2. #2
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    function xBtnPosition(btnName: DisplayObject, btnXpercentage: Number):String

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    4
    Wow! Thanks beathoven! So I take it you are an actionscript 3 genius? lol. Been around since 2002, you got a website I can visit?

  4. #4
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Quote Originally Posted by arod87 View Post
    Wow! Thanks beathoven! So I take it you are an actionscript 3 genius? lol. Been around since 2002, you got a website I can visit?
    I am actually not no. I just started coding again. Just happened to come here around 2002 looking for help in AS2. Didn't make websites for a couple years then started again a year ago.

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