Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8860699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:18:56+00:00 2026-06-14T15:18:56+00:00

The problem is simple: I need to pass actual variable to a function. private

  • 0

The problem is simple:
I need to pass actual variable to a function.

private var test:String = "KKK";
trace (" Before --->>> " + test);
testFunction(test);
trace (" Next --->>> " + test);

private function testFunction(d:String):void{
   d = "MMM";
}

Result:

Before --->>> KKK
Next --->>> KKK

The result is correct but, What I want is, send the actual test variable to my function and change that. So I want to have output like this:

Before --->>> KKK
Next --->>> MMM

Any solution?

Thanks for your answer but if I have a code like this, I need to pass the actual variable to my function:

if ( lastPos == -1 ){// if this is first item 
    flagLEFT = "mid";
    tempImageLEFT = new Bitmap(Bitmap(dataBANK[0]["lineimage" + 10]).bitmapData);
}else if (nextPos == -1){// if this is the last position
    flagRIGHT = "mid";
    tempImageRGHT = new Bitmap(Bitmap(dataBANK[0]["lineimage" + 13]).bitmapData);
}

As you see, changes are in flagLEFT and tempImageRGHT . Also I have a change on numbers (10 and 13) which can be handle in normal way. I need something like this:

private function itemFirstLast(flag:String, bmp:Bitmap, pos:int):void{
    flag = "mid";
    bmp = new Bitmap(Bitmap(dataBANK[0]["lineimage" + pos]).bitmapData);
}

Any solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:18:57+00:00Added an answer on June 14, 2026 at 3:18 pm

    One way is to return the new string and assign it to test :

    private var test:String = "KKK";
    trace (" Before --->>> " + test);
    test = testFunction(test);
    trace (" Next --->>> " + test);
    
    private function testFunction(d:String):String{
       d = "MMM";
       return d;
    }
    

    This still doesn’t pass the actual string object but the test string will change. Strings are passed by value in AS3, if you wan’t to actually pass it in you can wrap it in an object :

    var object:Object {
       "test":"KKK"
    };
    trace (" Before --->>> " + object["test"]);
    testFunction(object);
    trace (" Next --->>> " + object["test"]);
    
    private function testFunction(o:Object):void{
        o["test"] = "MMM";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big problem with very simple code. I need to get a
I need to associate two models with a simple has_many. The problem is that
I need to calculate the net total of a column-- sounds simple. The problem
For a few days a have some problem. I need to show simple ProgressBar
Really simple problem: I want to split a connection string into its keyword /
simple problem with a simple question. I have a string, in C# i can
I need to pass a url string from the view to the controller, a
I have really simple problem in my PHP script. There is a function defined
Here's a simple problem I need to solve, but it makes me feel my
I need to pass array list to SOAP service: var arrayList = new ArrayList

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.