问题
how to put Value for X and Y Position in Variable and Array
object = (XPosition , YPosition) box_mc.x = 300 , box_mc.y = 200
回答1:
Try to improve your question.
Is that what you wanna do?
import flash.geom.Point;
var p:Point = new Point(200,300);
box_mc.x = p.x;
box_mc.y = p.y;
You may also store your values in a bi-dimensional Array as here bellow :
var a:Array = [[200,300],[150,200]];
box_mc.x = a[0][0]; //200
box_mc.y = a[0][1]; //300
or in this case as you have stored two values for posx and posy :
box_mc.x = a[1][0]; //150
box_mc.y = a[1][1]; //200
You may also check those links to understand the difference between the different kind of types where you may store values :
ActionScript 3 fundamentals: Arrays
ActionScript 3 fundamentals: Associative arrays, maps, and dictionaries
ActionScript 3 fundamentals: Vectors and ByteArrays
来源:https://stackoverflow.com/questions/39375530/how-to-save-x-y-position-object-in-variable-and-in-array-by-as3