Skip to main content
Inspiring
March 14, 2007
Question

Variable Order of Selction

  • March 14, 2007
  • 6 replies
  • 551 views
Okay, here is another head scratcher – at least for me.

I'm making a multiplication table and posing a question like "5 x 7 = ?"

Then the user clicks on the factors along the side and the row or column gets highlighted.

The problem is that they could select either factor in either a row or a column first. If they select in a row I need to make sure the next one is in a column and vice versa.

The only solution I'm coming up with is a crazy string of if, else, and if else conditional statements. There has got to be a cleaner way.
This topic has been closed for replies.

6 replies

kglad
Community Expert
Community Expert
March 14, 2007
ok. you're welcome.
RothrockAuthor
Inspiring
March 14, 2007
Thanks I will give this a going over and check it out.

The evtObj from the EventDispatcher also includes if they clicked on a product square or a factor square. For the first part of the exercise we are only interested in them clicking on factors. For the next part we will be looking at products.
kglad
Community Expert
Community Expert
March 14, 2007
you could use an onMouseDown to total the number of clicks and use a hitTest to determine if they've clicked on one of the correct factors. if they do, reset the click count and if they don't test if they've exceded your limit for incorrect clicks.
RothrockAuthor
Inspiring
March 14, 2007
I'm not sure how that will help. I'll still be faced with the problem of figuring out which of the combinations I've taken and which isn't good. TheI've got the boxes in the mutliplication table sending events.

A typical event would be {target:"_level0.table.rFactor7",factor:7,dir:"r"}

With possible values for dir being "r" for a row that was clicked on and "c" for a column.

I think I would have the same problem tyring to figure out the conditional structure regardless of the mechinism of retrieving which item I clicked on.
kglad
Community Expert
Community Expert
March 14, 2007
try:

RothrockAuthor
Inspiring
March 14, 2007
So I tried that out. And it seems to help.

But, there is a negative feedback sound that needs to play.
RothrockAuthor
Inspiring
March 14, 2007
That is a great idea. I'm trying to think it through and I'm wondering if it helps me with the second part of the problem.

I've also got the problem that if they don't get the correct one in a couple of clicks, then I've got to highlight it for them.
kglad
Community Expert
Community Expert
March 14, 2007
assuming the factors are movieclips, disable the other 9 column movieclips if a column movieclip is selected. disable the other 9 row movieclips if a row movieclip is selected.