Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: FLASH: Rapid TellTargets, Multiple MouseClicks crash Flash
From: Marc Hoffman
Date: Thu, 4 Mar 1999 05:37:45 GMT

This is a somewhat long-winded request for information.

I just worked through a complex problem in Flash. I came up with a fix
without completely understanding what caused the problem. If anyone on the
list can help me better understand the problem, I'd appreciate it. You may
also find my solution of use, since it relies on an unorthodox application
of an invisible button.

THE PROJECT
I was structuring a complex game. It takes place in a stopped frame of a
larger movie. In this game, the user is confronted with a number of buttons
that represent answers. Several buttons are "correct" guesses, the rest are
wrong. Clicking on a correct guess 1) causes a unique, associated MC to
display a graphic, 2) causes another MC to ring a bell, and 3) causes an
invisible MC to advance one frame (keeping an invisible score). A wrong
guess 1) causes one MC to sound a buzzer and 2) causes another MC to flash
one of three warnings in sequence . After three warnings, one of the
correct guesses is revealed, to help the player out a bit. The game
continues until the score-keeping clip determines that the total number of
correct guesses have been discovered, at which point it causes the game to
end and the main movie moves on to other interesting stuff.

THE PROBLEM
The problem was that if the player just started punching buttons like
crazy, one of two things might happen: either the score-counter did not
register all the correct hits (in which case the movie never moved ahead
after all correct guesses were made), or Flash crashed, locking up and
requiring a forced exit from the program.

FAILED SOLUTIONS
I figured the problem was that there were too many TellTargets being issued
in too short a time period, and with MCs jumping around among their
internal frames, some of the TellTargets were getting lost or interrupted
mid-execution. I tried a number of ways of using more MCs with simpler
demands made of each one. I also tried to build in some time delays so the
commands would be spread out in time. There was some improvement but it
still wasn't bullet-proof.

THE FIX
What I finally did was to limit the number of mouse clicks in a given time.
I put a large invisible button in the last two frames of a MC that was
stopped in the first frame. Every time the user clicked one of the "guess"
buttons, the MC would play, positioning the invisible button over the array
of "guess" buttons, preventing them from receiving mouse events for the
duration of two frames. Then the MC would return to its empty frame #1,
the invisible button would no longer be present, and the "guess" buttons
would be active again. This was 100% reliable.

MY QUESTION
What I would like to know is if others have had trouble with Flash seeming
not to keep up with rapid series of commands. How about Flash crashing from
too much MC activity at once? Are there situations where MCs aren't really
keeping the same frame rate, so they get out of sync? By the way, I was
not TellTargeting anything that was not already present on the timeline,
but I wonder if a MC in action might not receive TellTargets reliably.
Ideally, I would like to understand what it is about Flash's architecture
and functioning that would cause these problems. This is my attempt to
understand the inner workings of Flash, not just the rules for making Flash
work, so that I can have a better basis for understanding similar problems
in the future. Any insights would be welcome!

Whew!!!


Marc Hoffman
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
marcatdartfrogmedia [dot] com (mailto:marcatdartfrogmedia [dot] com)
My home site is now featured in Ken Milburn's book, Flash 3 Web Animation f/x
and Design. Play a virtual marimba there: <www.dartfrogmedia.com/dartfrog>.
View my Flash3 samples: <http://www.jps.net/dartfrog/sampler>.
Read about Flash: <http://www.jps.net/dartfrog/sampler/flashinf>

------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-manageratshocker [dot] com. Problems to: owneratshocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-manageratshocker [dot] com


Replies
  Re: FLASH: Rapid TellTargets, Multiple M, Brad Merritt
  Re: FLASH: Rapid TellTargets, Multiple M, John Croteau

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]