Yup, I didn't read the doc on getFocus. It returns a 'targetPath',
which is a string (not an object or movieClip referencs) so you do
have to use eval. I guess this is just a Flash quirk, which will be
in platform-specific code in OL4.
So, I retract all my comments, your patch is approved as is.
On 2007-03-22, at 13:21 EDT, Sarah Allen wrote:
As it turns out, ss is a string. How important is it to avoid
eval? the string looks like this: "_level0.$m0.$LzText"-- I could
chop off the _level0 and write _level0[substring+'__lzview'] ...
On Thu, Mar 22, 2007 at 3:03 AM, P T Withington wrote:
I'm cc-ing max, because this may be important to track in OL4
Sprites. He might also have some ideas on how it rotted. It
looks to me like what may have rotted was the assumption that you
could find the view associated with a clip by looking for the
field named view in its parent clip. That's what I think the
substring malarkey is all about. If you cast a clip to a string,
it will come out as `_root. ... .<parent>.<child>`, and the
substring looks like it is trying to get the property `view` from
the parent clip. Your solution of an explicit backpointer on
every clip is better.
Approved with the following comment:
This:
var focusview = eval( ss + ".__lzview");
_root.Debug.warn("Selection.getFocus: %w, %w",
focusview, ss);
if ( focusview ) view = focusview;
is better written:
var focusview = ss['__lzview'];
if ( focusview ) {
view = focusview;
} else if ($debug) {
Debug.warn("LzModeManager: Can't find view for %s from %w",
eventStr, ss);
}
That is, avoid `eval`, and you left a debug statement in, but
maybe you want to have a warning for when you can't find the view?
On 2007-03-21, at 22:50 EDT, Sarah Allen wrote:
Tucker,
Please review, see detailed description below. It's definitely
some achaic LFC/Flash lore. This is something that use to work
years ago and I don't know when it broke. Pablo and I worked on
it together, but I think it is important that it be reviewed by
someone on the platform team.
Thanks,
Sarah
--------------------------------------------------------
Change 20070321-sallen-4 by [EMAIL PROTECTED] on 2007-03-21
19:15:50 PDT
in /cygdrive/c/laszlo/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: mouse events for input and selectable text
Bugs Fixed: LPP-3753 onmouseup and onmousedown not reported by
LzGlobalMouse for inputtext and selectable text
Technical Reviewer: [EMAIL PROTECTED] (review code)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: in sending events the LFC has special logic to tell if
the user clicks on an input text or selectable text field (since
we don't get the movie clip that was clicked on from Flash, but
we can find out what movie clip is the selection. This logic is
in LzModeManger. To find the view associated with the movie
clip, we rely on a property that the text views set on their
corresponding movie clip. That used to be called 'view' but was
changed to '__lzview' at some point for inputtext and seems to
have gotten lost for test. This change fixes that.
Tests:
Files:
A test/text/mouse_events.lzx
M WEB-INF/lps/lfc/services/LzModeManager.as
M WEB-INF/lps/lfc/views/LzText6.as
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070321-
sallen-4.tar\n