要取出第r行冲凯、第散大唤c列的矩阵元素用:A(r,c)
要取出仿核第r行、第c列的cell成员用:A{r,c}
依次将每一张图片转换成影片剪辑(在图片上点右键-转换为元件-影片剪辑),然后在实例老毁名称(属性-实例名称)处依次命名为mc1、mc2、mc3...(假如加李的图片共有5张,则李命名为mc1,其余依次为mc2-mc5),然后画一个矩形作为区域,同样转换为影片剪辑,命名为mcmc,最后在这一帧添加帧动作:var aArr:Array = new Array()
var bArr:Array = new Array()
for (i=1i<=5i++) {
aArr[i] = this["mc"+i]._x
bArr[i] = this["mc"+i]._y
}
mc1.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
startDrag(this)
}
}
mc1.onMouseUp = function() {
if (this.hitTest(mcmc)) {
stopDrag()
} else {
stopDrag()
this._x = aArr[1]
this._y = bArr[1]
}
}
mc2.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
startDrag(this)
}
}
mc2.onMouseUp = function() {
if (this.hitTest(mcmc)) {
stopDrag()
this._x = aArr[2]
this._y = bArr[2]
} else {
stopDrag()
}
}
mc3.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
startDrag(this)
}
}
mc3.onMouseUp = function() {
if (this.hitTest(mcmc)) {
stopDrag()
this._x = aArr[3]
this._y = bArr[3]
} else {
stopDrag()
}
}
mc4.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
startDrag(this)
}
}
mc4.onMouseUp = function() {
if (this.hitTest(mcmc)) {
stopDrag()
this._x = aArr[4]
this._y = bArr[4]
} else {
stopDrag()
}
}
mc5.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse, true)) {
startDrag(this)
}
}
mc5.onMouseUp = function() {
if (this.hitTest(mcmc)) {
stopDrag()
this._x = aArr[5]
this._y = bArr[5]
} else {
stopDrag()
}
}
//不知核配道为什么,改含指用循环不行,只能这样写代码了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)