如何通过AS3将X Y位置对象保存在变量和数组中? [英] How to Save X Y Position Object in Variable and in Array by AS3?
本文介绍了如何通过AS3将X Y位置对象保存在变量和数组中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在变量和数组中放置X和Y位置的值
how to put Value for X and Y Position in Variable and Array
object =(XPosition,YPosition) box_mc.x = 300,box_mc.y = 200
object = (XPosition , YPosition) box_mc.x = 300 , box_mc.y = 200
推荐答案
尝试改善您的问题.
这是你想做什么吗?
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
,或者在这种情况下,因为您存储了posx和posy的两个值:
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 :
这篇关于如何通过AS3将X Y位置对象保存在变量和数组中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文