In reading the B3 code at least leaving the value unset should go ahead
and clear the style.  Also passing {null} should do it.

But you know, if the states arne't related to each other (no based on)
just having the SetStyles for the ones you care about should be enough,
we'll automatically unset the ones that were in the previous state. 

Matt

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of revanisle
Sent: Thursday, April 27, 2006 10:15 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] F2B2 & States: How to clear/remove a style set in
a state

Hi all,
  For simplification, let's say I have an app with two states as
follows:

<mx:states>
  <mx:State name="LEFT">
    <mx:SetStyle target="{PREVIEW}" name="left" value="0"/>
    <mx:SetStyle target="{PREVIEW}" name="right"/>
  </mx:State>
  <mx:State name="RIGHT">
    <mx:SetStyle target="{PREVIEW}" name="left"/>
    <mx:SetStyle target="{PREVIEW}" name="right" value="0"/>
  </mx:State>
</mx:states>

<mx:Canvas id="PREVIEWHOLDER"
      includeInLayout="false"
      x="20"
      y="20"
      width="1000"
      height="1000">
      <mx:Canvas id="PREVIEW"
            <mx:Image id="previewImg">
            </mx:Image>
      </mx:Canvas>
</mx:Canvas>

The idea is that in state LEFT, PREVIEW anchors to the left of it's
parent container PREVIEWHOLDER, and state RIGHT anchors it to the
right edge of PREVIEWHOLDER.  PREVIEW is always smaller than its
parent, but its size changes as it is being populated with content.
(mostly determined by the size of the image loaded into previewImg)

What actually happens is that whichever state is used first works
fine, but when I switch to the other state, PREVIEW is anchored to
both sides of its parent, making it 1000px wide regardless of what's
inside it.  My real app actually has 4 states, but the idea is the same.

This code:
    <mx:SetStyle target="{PREVIEW}" name="right"/>
(without any value attribute) was generated by FlexBuilder when I
cleared the right anchor in design view, and it doesn't work.  It also
doesn't work by setting the value attribute to any of "", "{null}", or
"{undefined}".  Leaving the tag out altogether also doesn't work.

How do I create a state that says "DON'T anchor to the right anymore."

Thanks!

Rick Englert








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to