Friday, June 8, 2012

Success again!

So there were technical hurtles, at the start that I was unsure if I could get them to work the way I wanted.  The first was copying.  Which with a little finesse is now up and running.  The other was recognizing items being floated over.  Normally something really simple but not so when each item can move around the screen and even be stacked on top of each other.  I can proudly say that I have leapt that hurtle as well, and it fell a lot easier then I was expecting.  As a matter of fact there were a few times when I thought that this one might be a lot tougher.  But using the extends command for all the classes worked wonders.  And with just modifying the on screen holder so that the last item is always at the top it makes for an easy way to recognize what class or item the drag is floating over.

The code once all that is set up is so simple its almost sad.


public function findDropType(e) {
for(var i:int = 0; i < msBuilder.msItems.length; i++) {
if(e.target.x > msBuilder.msItems[i].xSTNOW && e.target.x < ( msBuilder.msItems[i].xSTNOW + msBuilder.msItems[i].xWidth) &&
e.target.y > msBuilder.msItems[i].ySTNOW && e.target.y < ( msBuilder.msItems[i].ySTNOW + msBuilder.msItems[i].yHeight) ) {
trace("hit x " + msBuilder.msItems[i]);
break;
}
}
}

Now off to about 2-3 weeks of really dull/boring programming as I interconnect everything.  You have been warned... its going to be a snooze fest or x and y positioning and handling drag and drops.  I'm already bored of it.  All the fun stuff was the last week.

Daisy

1 comment: