actionscript 3 - as3 how to change a number by a class? -
the following code isn't working:
package { public class num { public function num() { } public function numto(num1:number) { num1 = 47; } } }
when use in main timeline:
import num; var n:number = 17; numto(n); trace(n); // must 47 instead of 17
it gives me different error messages such as:
access of undefined property numto;
you should try learn basics of actionscript language. read general books, understand going on.
as question specifically. there such things reference types , value types. not explain here because there plenty of material on topic, can google it. number value type. means when pass number method parameter arrives there new "instance". not hold reference original number.
Comments
Post a Comment