0 Replies Latest reply on Dec 20, 2007 10:06 AM by wendallsan

    how do I get properties of a tweenEffect's target?

    wendallsan
      Hi All,

      Very new to flex, old at Actionscript, but I'm trying to get used to MXML . . . I have a Canvas instance that I want to give mouseOver/mouseOut behavior to have it grow to a certain size when moused over and then shrink when moused out. I've gotten this to work with static numbers for the from and to values of the resize, but I'd like the from value to be "whatever the current value of the Cavas instance is". That way if a user mouses over and out quickly, it will not begin to grow when moused over, then jump to full size when moused out and the shrink. I want it to shrink from whatever it's current size is at the moment. Problem is I'm not sure how to do this within a TweenEffect instance. Here's my code if that will help, I want to be able to replace the {N_HEIGHT} in the tsunamiItemGrow effect and the {M_HEIGHT} in the tsunamiItemShrink effect to the actual values of the calling object at the time that the effect is run. Any help is greatly appreciated.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center">
      <mx:Script>
      <![CDATA[

      var N_HEIGHT:Number = 100;
      var N_WIDTH:Number = 80;
      var M_HEIGHT:Number = 150;
      var M_WIDTH:Number = 120;

      ]]>
      </mx:Script>

      <mx:Resize id="tsunamiItemGrow" heightFrom="{N_HEIGHT}" heightTo="{M_HEIGHT}" widthFrom="{this.width}" widthTo="{M_WIDTH}" duration="250" />
      <mx:Resize id="tsunamiItemShrink" heightFrom="{M_HEIGHT}" heightTo="{N_HEIGHT}" widthFrom="{this.width}" widthTo="{N_WIDTH}" duration="250" />

      <mx:Canvas id="tsunamiMenu" bottom="10" left="10" right="10">
      <mx:HBox id="tsunamiHBox" horizontalAlign="center" verticalAlign="bottom" horizontalCenter="0">
      <mx:Canvas id="a" backgroundColor="0xFF0000" width="{N_WIDTH}" height="{N_HEIGHT}" rollOverEffect="{tsunamiItemGrow}" rollOutEffect="{tsunamiItemShrink}"/>
      <mx:Canvas id="b" backgroundColor="0x00FF00" width="{N_WIDTH}" height="{N_HEIGHT}" rollOverEffect="{tsunamiItemGrow}" rollOutEffect="{tsunamiItemShrink}"/>
      <mx:Canvas id="c" backgroundColor="0x0000FF" width="{N_WIDTH}" height="{N_HEIGHT}" rollOverEffect="{tsunamiItemGrow}" rollOutEffect="{tsunamiItemShrink}"/>
      <mx:Canvas id="d" backgroundColor="0xFFFF00" width="{N_WIDTH}" height="{N_HEIGHT}" rollOverEffect="{tsunamiItemGrow}" rollOutEffect="{tsunamiItemShrink}"/>
      </mx:HBox>
      </mx:Canvas>

      </mx:Application>