The problem is simple: I need to pass a valid 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 I want to send the current variable testto my function and change it. So I want to have this output:
Before --->>> KKK
Next --->>> MMM
Any solution?
Thanks for your answer, but if I have such code, I need to pass a valid 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 can see, the changes are in flagLEFTand tempImageRGHT. I also have a change on numbers (10 and 13) that can be processed in the usual 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?
source
share