Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
982 views
in Technique[技术] by (71.8m points)

actionscript 3 - How to Save X Y Position Object in Variable and in Array by AS3?

how to put Value for X and Y Position in Variable and Array

object = (XPosition , YPosition) box_mc.x = 300 , box_mc.y = 200

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...