I’m trying to create a small app where users are given a word which they then have to create by dragging the Mc’s. Basically, a word appears in a dynamic txt box and you then have to drag the mc’s to spell the word. I’ve managed, thanks to help from forum users(!!!), to finish the drag part but I’m not sure how to code the array which links links with the draggable mc’s… If anyone could point me in the right direction I’d be very grateful!
This is he code I’m using so far:
alphabet=new Array(null,"A","B","C","D")
nodez=[]
for(i=1;i<5;i++){
node=_root["mov"+i];
nodez*=node;
node.startX=node._x;
node.startY=node._y;
node.cText=node.blockTxt.text=alphabet*
node.onPress=onDrag
node.onRelease=noDrag
}
_root.onEnterFrame=function(){
var x1,y1,x2,y2,nodeA,nodeB
for(i=1;i<5;i++){
nodeA= nodez*
for(j=i+1;j<nodez.length;j++){
nodeB=nodez[j]
if(nodeA.hitTest(nodeB)&&i!=j){
if(!dragging){
var temp1=nodeA.cText
nodeA.blockTxt.text=nodeB.cText
nodeB.blockTxt.text=nodeB.cText=nodeA.cText
nodeA.cText=nodeA.blockTxt.text
}
}
}
if(!dragging&&nodeA.hitTest()==false){
nodeA._x=nodeA.startX
nodeA._y=nodeA.startY
}
}
}
function onDrag (){
this.startDrag();
dragging=true
this.swapDepths(6)
}
function noDrag (){
this.stopDrag();
dragging=false
}
wB