I am not getting any errors with the code you posted :S
Printable View
I am not getting any errors with the code you posted :S
Thats strange, could you open the attached and see if you get any?
Nope, no errors. Maybe it's because of CS5.5? :p
Thanks so much for all your help. The attached is 95% there but for some reason dosnt seem to operate consistanly. If the users click 4 times anywhere on the circumference area and those 4 points draw two lines which are more or less 90 degrees apart then it should be correct. But i am getting mixed result and am not sure why?
What do you mean, I don't get it, it works perfectly here???
Have you changed your mind? You said in an earlier post that you wanted the 4 parts to be selected in a specific order :S?Quote:
If the users click 4 times anywhere on the circumference area and those 4 points draw two lines which are more or less 90 degrees apart then it should be correct.
i think the problem is here:
Actionscript Code:onMouseDown = function(){
if(i < 4){
attachMovie("marker_mc", "marker"+i, i, {_x:_xmouse, _y:_ymouse});
Add "};" to close the if
Actionscript Code:onMouseDown = function(){
if(i < 4){
attachMovie("marker_mc", "marker"+i, i, {_x:_xmouse, _y:_ymouse});
};
Hi, yes, the requirement has changed and simplified i guess...but i cant work out how to simplyfy the code i have....
Anyone?????
Sorry mileso. I reed your thread weeks ago, i looked to your fla but i'm not familiarized with scripted vectors, pixeles, bitmaps. Maybe our friend Nig13 can help you? Nig!!! *Bump*
What do you really want to do right now?
Actionscript Code:onMouseDown = function(){
if(i < 4+1){
Now you can create 4 crosshairs and form the cross. Before that, you could only create 3.
Hi,
sorry for the long wait, I was busy :P
If the requirement has been changed, then simply remove the code which checks the order:
Actionscript Code:if(i == 0){
if(sides == 1){
points++;
}
} else if(i == 1){
if(yolk == 1){
points++;
}
} else if(i == 2){
if(rump == 1){
points++;
}
} else if(i == 3){
if(crown == 1){
points++;
}
}
if(points == 4){
correct = true;
}
i++;
}
and then change the code a bit to not check for points variable, making the new code something like this:
Actionscript Code:i = 0;
n = 4;
rump = 0;
crown = 0;
sides = 0;
yolk = 0;
points = 0;
correct = false;
down = false;
this.onMouseMove = function()
{
if(down && i < 4){
mc.clear();
mc.lineStyle(2, 0xFFFF00, 100);
mc.moveTo(x0,y0);
mc.lineTo(_xmouse,_ymouse);
updateAfterEvent();
}
};
onMouseDown = function(){
if(i < 4){
attachMovie("marker_mc", "marker"+i, i, {_x:_xmouse, _y:_ymouse});
if(rump_bt.hitTest(_xmouse, _ymouse, true)){
rump = 1;
} else if(crown_bt.hitTest(_xmouse, _ymouse, true)){
crown = 1;
} else if(sides_bt.hitTest(_xmouse, _ymouse, true)){
sides = 1;
} else if(Yolk_bt.hitTest(_xmouse, _ymouse, true)){
yolk = 1;
}
i++;
mc = this.createEmptyMovieClip("mc" + n, n);
n++;
x0 = _xmouse;
y0 = _ymouse;
}
}
onMouseUp = function(){
if(i == 4){
submit_bt._visible = true;
diff1X = marker1._x - marker0._x;
diff1Y = marker1._y - marker0._y;
diff2X = marker3._x - marker2._x;
diff2Y = marker3._y - marker2._y;
diff1 = (Math.atan2(diff1Y, diff1X)*180/Math.PI)+180;
diff2 = (Math.atan2(diff2Y, diff2X)*180/Math.PI)+180;
difference = Math.abs(diff1-diff2);
trace(difference);
degree.text = difference;
}
x0 = _xmouse;
y0 = _ymouse;
down = !down;
}
background_bt._visible = false;
reveal_a._visible = false;
reveal_b._visible = false;
reveal_bt._visible = false;
reveal_bt._visible = false;
retry_bt._visible = false;
submit_bt._visible = false;
yolk_arrow._visible = false;
cover_bt._visible = false;
submit_cover._visible = false;
cd_dash._visible = false;
ab_dash._visible = false;
cover_bt.useHandCursor = false;
ended = false;
Yolk_bt._visible = false;
rump_bt._visible = false;
crown_bt._visible = false;
sides_bt._visible = false;
submit_bt.onRelease = function() {
ended = true;
if((difference > 85) && (difference < 95))
//The angle between the two lines is between 85 degrees and 95 degress and therefore correct and the 4 points are all correctly placed.
{
cover_bt._visible = true;
feedback.htmlText = "<b>Correct.</b>\n\nYou have correctly placed the two abdominal diameter measurements at the abdominal circumference and at right angles to each other.";
submit_bt._visible = false;
}
else if((difference < 85 || difference > 95))
//The angle between the two lines is either less than 85 degrees or greater than 95 degress but the 4 points are all correctly placed.
{
feedback.htmlText = "<b>Incorrect.</b>\n\nRemember that the two measurements should be at right angles to each other.";
reveal_bt._visible = true;
retry_bt._visible = true;
submit_bt._visible = false;
}
else if((difference > 85) && (difference < 95))
//The angle between the two lines is between 85 degrees and 95 degress and therefore correct but one/all of 4 points are incorrectly placed.
{
feedback.htmlText = "<b>Incorrect.</b>\n\nEach of the two measurements should touch the circumference of the abdomen.";
reveal_bt._visible = true;
retry_bt._visible = true;
submit_bt._visible = false;
}
//The angle between the two lines is either less than 85 degrees or greater than 95 degress and one/all of 4 points are incorrectly placed.
else if ((difference < 85 || difference > 95))
{
feedback.htmlText = "<b>Incorrect.</b>\n\nRemember that the two measurements should be at right angles to each other and each of the two measurements should touch the circumference of the abdomen.";
reveal_bt._visible = true;
retry_bt._visible = true;
submit_bt._visible = false;
}}
reveal_bt.onRelease = function () {
for(a=0;a<i;a++){
removeMovieClip(_root["marker"+a]);
}
for(k=4;k<n+1;k++){
removeMovieClip(_root["mc"+k]);
}
ended = true;
feedback.htmlText = "";
ab_dash._visible = true;
cd_dash._visible = true;
retry_bt._visible = false;
cover_bt._visible = true;
reveal_bt._visible = false;
submit_bt._visible = false;
reveal_a._visible = true;
reveal_b._visible = true;
yolk_arrow._visible = false;
};
retry_bt.onRelease = function (){
for(a=0;a<i;a++){
removeMovieClip(_root["marker"+a]);
}
for(k=4;k<n+1;k++){
removeMovieClip(_root["mc"+k]);
}
n = 4;
points = 0;
degree.text = ""
i = 0;
rump = 0;
crown = 0;
sides = 0;
yolk = 0;
cd_dash._visible = false;
ab_dash._visible = false;
ended = false;
cover_bt._visible = false;
yolk_arrow._visible = false;
reveal_bt._visible = false;
retry_bt._visible = false;
feedback.htmlText = "";
submit_bt._visible = false;
}
It should work...
I understand the issue. You click one point and another point, and a part of the crosshair is created. Then you click 3rd point but you can't make point 4th because when 3rd point is created, the submit button is visible and don't let you click.
I have no idea any longer as this post has been continued for so long and I've lost track of everything here. I really should learn to add comments to codes, but meh, too lazy. I dunno about the 4 click issue, as it works for me, lolz, and it looks like this guy is absent >.<"
I took my time to understand the codes, but I don't find how to make it works. If you click randomly 4 times, you'll be able to make 4 crosshairs, but if you click correctly and form the first part of the main cross, when you want to click 2 more times to make the other part of the cross, you'll only be able to make 1, the 3rd crosshair and not the 4th. I'm using the original posted FLA. I tried overwriting the original FLA with your last script, Nig, but it doesn't create the cross, it only attaches the crosshairs with the lines along.
Try it yourself, click one point, then the 2nd point and create a red or yellow line (part of the cross) then try to click 3rd point and 4th point to cread the other part of the cross (if you made the red one, now try the yellow one) and you'll see you can only make the 3rd crosshair, inmediately shows up the Submit button and you can't click anymore to create the 4th crosshair to creat the last part of the cross. And he is not abcent, he commented yesterday, that's why I commented to and tried to help. :D