My concern with that approach is that when I animate the object for other reasons the controls may pop up unexpectedly.  Right now I'm checking the width in the onstop even for the appropriate animation.  But it doesn't seem to be consistently working - sometimes the animation completes but no controls show up.  Maybe there is some rounding error in the final width value...

Jim Grandy wrote:
I think you'll run into LPP-1248 with that technique, which will cause the view width to go to zero. See the thread from last week where we discussed this.

Bret's suggestion is the most efficient way of doing this, but I think the visible="${ parent.width==200}" technique would work as well without being wrapped in a state, just less efficiently:

<canvas>
  <view ...>
<text text="Text" visible="${parent.width==200}"/>
  </view>
</canvas>

jim

On Dec 19, 2005, at 12:50 PM, Jeff Freedman wrote:

Denis,

 

The following code does nicely what I believe you’re looking for using states:

 

<canvas>

<view width="100" height="100" bgcolor="red" onmouseover="min.remove();max.apply()" onmouseout="max.remove();min.apply()">

            <state name="max" apply="false">

                  <animator attribute="width" to="200" duration="2000" />

                  <text name="content" text="Text" visible="${parent.width==200}"/>

            </state>

            <state name="min" apply="true">

                  <animator attribute="width" to="100" duration="2000" />

            </state>

</view>

</canvas>

 

Note the visible=”${parent.width==200}” which sets the text visible only if the view’s width = 200.

 

Jeff

 

> Date: Mon, 19 Dec 2005 11:46:35 -0800

> From: Bret Simister <[EMAIL PROTECTED]>

> Subject: Re: [Laszlo-dev] event on animator completed vs stop?

> To: Henry Minsky <[EMAIL PROTECTED]>

> Cc: [email protected], [email protected]

> Message-ID: <[EMAIL PROTECTED]>

> Content-Type: text/plain; charset=ISO-8859-1; format=flowed

> 

> Denis,

> 

> For the behavior that you are trying to achieve, the use of the onstop event is not

> appropriate. An onstop is always generated when a single animation completes on an object

> but the "value" of that object is not guaranteed to be the same as the value defined by

> the "to" attribute of that animator. Animators can be defined with absolute values, but

> ultimately all animators are translated into a relative space so that when they are

> executed, their behavior is more physics-like.

 

> What you want to know is when the width of an object reaches a certain value, and at that

> point display the text. This should be independent of the animation, so my suggestion is

> that you override the SetWidth method of the object and in that method check to see if

> the max value is being set. At that max value display the text otherwise hide it.

 

> Bret Simister

> Chief Interface Architect

 

> Henry Minsky wrote:

 

> animatorgroup is supposed to support 'onstop' event, but after  brief

> look at the  LFC source code to me it looks like animator doesn't send

> that event. Anyone more familiar with this?

> 

> On 12/16/05, *Denis Bohm* <[EMAIL PROTECTED]

> <mailto:[EMAIL PROTECTED]>> wrote:

> 

>     I'm trying to detect when an animator has completed changing an

>     attribute to the "to" value.  In the example below what I want to

>     happen

>     is that when you move the mouse into the red area then the area grows

>     and if the grow completes then the text will become visible.  When you

>     move the mouse out of the red area then the text becomes invisible

>     and

>     the view shrinks back.  This works fine if you hold the mouse

>     inside the

>     red are until the "max" animation completes.  But if you move the

>     mouse

>     back out of the view before it completes then an "onstop" event is

>     generated for "max" and it does not act as desired.  So what I'm

>     looking

>     for is something like and "oncomplete" event that is only called

>     if the

>     animation makes it to the to value.  Is there some way to detect

>     that?

> 

>     <canvas>

> 

>         <view width="100" height="100" bgcolor="red"

>     >

>             <animator name="max" attribute="width" to="200"

>     duration="2000"

>     start="false" />

>             <animator name="min" attribute="width" to="100"

>     duration="2000"

>     start="false" MsoNormal" style="">>     false);"/>

>             <text name="content" text="Text" visible="false"/>

>         </view>

> 

>     </canvas>

 

_____________________________________________
Jeff Freedman
Vice President, Technical Research and Development
267-587-0928

TPG TeleManagement, Inc.
www.tpginc.com
jeff.[EMAIL PROTECTED]

"Where Technology and Talent Come Together"

 

_______________________________________________
Laszlo-dev mailing list


_______________________________________________ Laszlo-dev mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-dev



_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to