PDA

View Full Version : hitTest problem


fumble
03-12-2003, 08:57 AM
Hiya - I'm a designer with practically no programming knowledge. Can anyone tell me why the following hitTest code isn't working?

on (release) {
if(_root.scale_1250, hitTest(_root.ex_master)){
scale_1250._droptarget;
setProperty("/scale_1250", _visible, 0);
setProperty("/ex_master", _visible, 0);
gotoAndStop(6);
} else {
scale_1250._droptarget;
setProperty("/scale_1250", _visible, 1);
setProperty("/ex_master", _visible, 1);
gotoAndStop(1);
}
}

The code is attached to the scale_1250 button as I can't get it to work in the actions on the timeline either. PLEASE HELP!

jaybee
03-12-2003, 09:16 AM
change the first if statement to:

if(_root.scale_1250.hitTest(_root.ex_master)){


also, I don't know what purpose the lines like scale_1250._droptarget; serve - _droptarget is a property and just referencing it like that wouild do nothing. remove?

fumble
03-12-2003, 09:35 AM
Originally posted by jaybee
change the first if statement to:

if(_root.scale_1250.hitTest(_root.ex_master)){


also, I don't know what purpose the lines like scale_1250._droptarget; serve - _droptarget is a property and just referencing it like that wouild do nothing. remove?

fumble
03-12-2003, 09:43 AM
on (release) {
if(_root.scale_1250.hitTest(_root.ex_master)){
scale_1250._droptarget;
setProperty("/scale_1250", _visible, 0);
setProperty("/ex_master", _visible, 0);
gotoAndStop(6);
} else {
scale_1250._droptarget;
setProperty("/scale_1250", _visible, 1);
setProperty("/ex_master", _visible, 1);
gotoAndStop(1);
}
}

Ok - I see that I had a comma instead of a dot, but still not working. BAsically what I want to do is for the user to click on the scale_1250 button and if they drop it on to ex_master button, then both fade and you go to the frame specified. However at the moment if you drop scale_1250 anywhere on the stage that happens. Iwas trying to combine hitTest and droptarget to achieve this. Any more suggestions?

jaybee
03-12-2003, 10:03 AM
check that you have the hittest working first of all:

on (release) {
if(this.hitTest(_root.ex_master)){
trace("hittest!");
}
}


make sure that code is "on" the button scale_1250........alternatively if you're using mx put this code on the main timeline:

scale_1250.onRelease = function() {
if(this.hitTest(_root.ex_master)){
trace("hittest!");
}
}


same thing different syntax. when you have that working, update the code in the if statement to this:


if(this.hitTest(_root.ex_master)){
this._visible = this._parent.ex_master._visible = false;
this.gotoAndStop(6);
} else {
this._visible = this._parent.ex_master._visible = true;
this.gotoAndStop(1);
}


hope it helps,

Jason Junker
03-12-2003, 01:44 PM
is your button inside a Movie Clip? Ya can't drag buttons... only Movie Clips.

This may NOT be your probelm - but sometimes... it's the simplest things!

J.