Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Action Scripting

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
US
Unfortunately I am forced to do something with Flash. I am fairly new to flashMX, although I've used flash 5 before. I find Action scripting more difficult that my C++ coding! Ahh I hate it, I wish i could just use Director! Anyway. I was trying to do the drag and drop dressup game when I discovered that my onClipEvent (mouseDown) returns true no matter where I click! I just want to be able to click on my movieClip and somethign happens, not click anywhere in the fricken movie. Geez, why is it that Director Lingo is so much more powerfuly yet its less confusing?
 
well ,well ,well it is not that bad , you just have to get used to it. I also program C++,and at first actionscript seems like a big mess,but after a while (I use it a month already) it will become clearer and easier.
as for your problem: indeed,mousedown is called whereever you click,but in your routine you should put another if that checks if(_name=="theobjectyouwanttomove){...}
and it will work just fine.
Greetz,
muppeteer.gif

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Use hitTest(). This works in a similar way to Lingo's intersect/intersects.

onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, false)) {
trace("hit");
} else {
trace("miss");
}
}
 
Thanks guys. I ended up using this code:

onClipEvent (load) {

_root.ball.onPress = function() {
startDrag(ball);
_root.ball._alpha=50;
}

_root.ball.onRelease = function() {
stopDrag();
_root.ball._alpha=100;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top