How stupid of me. Thank you very much.
--------------------------------------------------
From: "Ian Thomas" <i...@eirias.net>
Sent: Thursday, January 22, 2009 10:27 AM
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Subject: Re: [Flashcoders] [AS2] problem with conditional statement "else
if"
You need to use && instead of ||
(btn1._x > 208 || btn1._x < 241)
should be
(btn1._x > 208 && btn1._x < 241)
HTH,
Ian
On Thu, Jan 22, 2009 at 9:17 AM, jimmi <cho...@gmail.com> wrote:
Hi, for a project it is required that I make a module with AS2.
I already got most of the module working, except for one part: the
slider.
The slider button is supposed to stop at six points.
I thought that the if..else..if statement would do just fine for this
purpose.
The problem is that only the first two statements work, the rest doesn't.
So the slider slides just fine, but it only "snaps" to point one and
point two.
I also tried chekking the position of the btn with a onEnterFrame event,
it only traces "one" and "two".
When I specifically check the ._x position(without a conditional
statement) of the slider button it does trace that value.
As far as I know there isn't a difference in how AS2 and AS3 handle
conditional statements, right?
If anyone can help me in to the right direction with this it would be
mucht appreciated.
// click
btn1.onMouseDown = function()
{
btn1.startDrag(true,189,176,365.9,176)
}
// release
btn1.onMouseUp = btn.onReleaseOutside=function ()
{
if (btn1._x < 206 )
{
btn1._x = 189;
this.stopDrag();
trace("one");
}
else if (btn1._x > 208 || btn1._x < 241)
{
btn1._x = 224.3;
btn1.stopDrag();
trace("two");
}
else if (btn1._x > 243 || btn1._x < 273)
{
btn1._x = 259.7;
btn1.stopDrag();
trace("three");
}
else if (btn1._x > 279 || btn1._x < 309)
{
btn1._x = 295.1;
btn1.stopDrag();
trace("four");
}
else if (btn1._x > 313 || btn1._x < 345)
{
btn1._x = 330.4;
btn1.stopDrag();
trace("five");
}
else if (btn1._x > 351 || btn1._x < 377)
{
btn1._x = 365.9;
btn1.stopDrag();
trace("six");
}
else
{
trace("nuttin");
}
}
// check
onEnterFrame = function()
{
if (btn1._x < 206 )
{
trace("one");
}
else if ((btn1._x > 208) || (btn1._x < 241))
{
trace("two");
}
else if ((btn1._x > 243) || (btn1._x < 273))
{
trace("three");
}
else if ((btn1._x > 279) || (btn1._x < 309))
{
trace("four");
}
else if ((btn1._x > 313) || (btn1._x < 345))
{
trace("five");
}
else if ((btn1._x > 351) || (btn1._x < 377))
{
trace("six");
}
else
{
trace("nuttin");
}
// x value of btn1
trace(btn1._x)
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders