Hey all - My group and I are developing an app, and we've run into an error. Any help would be greatly appreciated. Thanks in advance! We have devices in a group. These devices are multiple instances of a movie clip. These clips, based on a root array, are told whether they have an error or not (1,0). If the device has an error, it sets it's parent's (group) error to on (1), but only if the parent error is 0. This all works fine and dandy until all the devices do not have an error, but the parent group is already keyed for an error. Then we cannot turn that error off. One stipulation, the devices have no idea about each other and the group cannot count how many devices there are.
loop through all devices in a group, then turn the group-error off, if none of the instances has error on. -E= [quoted text, click to view] "DieFrohKartoffel" <webforumsuser@macromedia.com> wrote in message news:cbcpl2$luo$1@forums.macromedia.com... > Hey all - > > My group and I are developing an app, and we've run into an error. Any help > would be greatly appreciated. Thanks in advance! > > We have devices in a group. These devices are multiple instances of a movie > clip. These clips, based on a root array, are told whether they have an error > or not (1,0). If the device has an error, it sets it's parent's (group) error > to on (1), but only if the parent error is 0. > > This all works fine and dandy until all the devices do not have an error, but > the parent group is already keyed for an error. Then we cannot turn that error > off. One stipulation, the devices have no idea about each other and the group > cannot count how many devices there are. > > >
We cannot loop through the devices and then check for the error as the code won't access the devices in the group. The group only looks at it's own error variable, whether it's 1 or 0. The devices (duplicate instances) check that variable, and then assign it if necessary. The problem we run into is this: When the group error is 0, the devices set the group error to 1 - which is perfect. However, once all the devices switch back to 0, the group error stays at 1. There is no way to reset this value. I know that's what you're getting at, but without being able to count the devices or have the devices talk to each other, there seems to be no solution. The devices check for the group error so that the group error variable isn't constantly switching between 1 & 0, making it impossible to display the error. //device code if (_parent.error==0){ // group OK if(error==0){ //device OK _parent.error=0; } else{ // device ERROR _parent.error=1; } } else{ // group ERROR if(error==0){ //device OK _parent.error=0; } else{ //device ERROR _parent.error=1; } //group code if(error==0){ //display GROUP OK } else{ //display GROUP ERROR }
why don't you create a temporary error array? if the device has an error, push the value to the array. then write a loop that checks for values in the array, and sets the group value accordingly, then reset the array to null.
An array is a good idea, however, to properly add to it and check it, the check/reset function needs to know how many devices (slots in the array) there are. This would cause a problem otherwise. Without knowing how many devices there are, the devices will constantly be writing to an ever-growing array, thus, there will always be an error reported in the device. Perhaps I should let the array fill up to an X number of times, then reset it and until there are no 0s found, keep the device error on. Hmmm.. Thanks, I'm going to try an alternate array solution. Thanks again for the input everyone....
Don't see what you're looking for? Try a search.
|