0
testing boolean value syntax
New Here
,
/t5/animate-discussions/testing-boolean-value-syntax/td-p/955393
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
hello, could somebody please help me with how to find the
value of 3 boolean objects in an if statement?
i have 4 movie clips which tral a character on contact, but i only want one to trail at a time. The objects trail when a hittest return a true value, so i've tried to put in a if statement where a hit test will only be tested on that object if the boolean value of the other 3 objects = false, but it isn't working and i have no idea where to go from there. I'm sure i had it working with 2 objects earlier, but i don't know where i've gone wrong. here's the code for one of the objects;-
i have 4 movie clips which tral a character on contact, but i only want one to trail at a time. The objects trail when a hittest return a true value, so i've tried to put in a if statement where a hit test will only be tested on that object if the boolean value of the other 3 objects = false, but it isn't working and i have no idea where to go from there. I'm sure i had it working with 2 objects earlier, but i don't know where i've gone wrong. here's the code for one of the objects;-
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955394#M257105
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
use the double equal (==) to test for equality.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guru
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955395#M257106
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
hey flawed - (sorry couldn't resist lol) although I'm not
certain how your 'trailing' code operates, I think I'd consider
going about this a little differently. I'd place all object
references within an array, and track one variable that is a
reference to the current object trailing, then run the test and
switch the current object when the hitTest returns true. Then I'd
use the current object reference in the trailing code. so for the
test below I'd do something like:
EDIT: sorry kglad - typing...
EDIT: sorry kglad - typing...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
fundamentally_flawed
AUTHOR
New Here
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955396#M257107
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
sorry but i'm completly lost!! kglad helped me quite alot
yesterday, i've only had a few days to work this out and am
completly new to programming. The section of code underneath just
passes a true boolean value to the trailing movie clip when hit
(objectA, ObjectC etc), and then false when the trailing object
comes into contact with another object (objectB). the boolean is
passed to code on the main timeline which attaches the objects.
I've tried push and pop, do while loops etc but i dont seem to be
getting anywhere. I tried the above code but now nothing will
trail, as opposed to everything
for(var i = 0; i < objectA.length;i++)
{
{
if(this.hitTest(this._parent.objectA ))
{
this._parent.objectA.booleanVar1 = true; //if hero hits answer a, trail
}
if(this.hitTest(this._parent.objectB )) //if answer a hits answer box - drop it
{
this._parent.objectA.booleanVar1 = false;
}
}
//-------------------------trailing object c
if(this.hitTest(this._parent.objectC ))
{
this._parent.objectC.booleanVar2 = true; //if hero hits objectC, trail
}
if(this.hitTest(this._parent.objectB )) //if answer c hits answer box (objectB)- drop it
{
this._parent.objectC.booleanVar2 = false;
}
}
for(var i = 0; i < objectA.length;i++)
{
{
if(this.hitTest(this._parent.objectA ))
{
this._parent.objectA.booleanVar1 = true; //if hero hits answer a, trail
}
if(this.hitTest(this._parent.objectB )) //if answer a hits answer box - drop it
{
this._parent.objectA.booleanVar1 = false;
}
}
//-------------------------trailing object c
if(this.hitTest(this._parent.objectC ))
{
this._parent.objectC.booleanVar2 = true; //if hero hits objectC, trail
}
if(this.hitTest(this._parent.objectB )) //if answer c hits answer box (objectB)- drop it
{
this._parent.objectC.booleanVar2 = false;
}
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guru
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955397#M257108
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
I'm sorry flawed, I know you're working hard on this system,
I just feel that it could be achieved more simply. So I made a
basic example for you, you can examine the code, and see how it
works. I also understand that kglad was helping you sort this out,
and if you want to continue with the methods you've been working
out, I won't be offended :)
@kglad: also not trying to step on you're toes kg, just was thinking there might be a simpler system here :)
download the example FLA file HERE
@kglad: also not trying to step on you're toes kg, just was thinking there might be a simpler system here :)
download the example FLA file HERE
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
fundamentally_flawed
AUTHOR
New Here
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955398#M257109
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
thanks so much for doing that, im sure i can take what i need
from it but i can't find the action code bits? i usually just left
click on the movieclips or on the timeline. could you tell me where
the code is?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guru
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955399#M257110
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
all the code is on frame 1, the top layer of the main
timeline. there is no code attached to MC instances, thats all of
it.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
fundamentally_flawed
AUTHOR
New Here
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955400#M257111
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
yey, sorry, found it
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
fundamentally_flawed
AUTHOR
New Here
,
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955401#M257112
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
thanks so much for doing that for me, but the reason i did it
this way is because the objects kind of floats behind the hero when
collected. maybe im just being too ambitious, and staring at the
computer screen for the last 10 hours probably isn't
helping!!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guru
,
LATEST
/t5/animate-discussions/testing-boolean-value-syntax/m-p/955402#M257113
Feb 10, 2008
Feb 10, 2008
Copy link to clipboard
Copied
that's no problem flawed, this is only a very basic example,
of the problem in question here. there are many additions that
could be made to the system as well, including 'how' the item
trails this was a very simple example and I took no time to add
anything like that although it can be done within the confines of
the methods as shown. the point is that these things could be
accomplished with a less diverse system of variables and check
procedures.
and yes lol, take a break!!! 🙂 then come back to it with fresh eyes...
and yes lol, take a break!!! 🙂 then come back to it with fresh eyes...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

