The Artima Developer Community
Sponsored Link

Web Buzz Forum
Styles and binding

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Manish Jethani

Posts: 53
Nickname: jethani
Registered: Aug, 2005

Manish Jethani is an engineer in the Flex team at Adobe.
Styles and binding Posted: Oct 17, 2005 5:33 PM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Manish Jethani.
Original Post: Styles and binding
Feed Title: Manish Jethani
Feed URL: http://feeds.feedburner.com/manish/artima
Feed Description: Software. RIA. Flex.
Latest Web Buzz Posts
Latest Web Buzz Posts by Manish Jethani
Latest Posts From Manish Jethani

Advertisement

In Flex 2 we've made a minor enhancement to the way data binding works with styles. Now you can bind a style property (CSS) just the way you'd normally bind an ActionScript property.

Here's a little example:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml">
  <mx:Panel title="Panel" backgroundColor="{colorControl.value}">
    <mx:ControlBar>
      <mx:Label>Background Color:</mx:Label>
      <mx:ColorPicker id="colorControl" selectedColor="red" />
    </mx:ControlBar>
  </mx:Panel>
</mx:Application>

[screenshot]

Note how the backgroundColor style of the Panel is bound to the ColorPicker value.

[screenshot]

Selecting a new colour from the dropdown immediately updates the Panel.

[screenshot]

This allows for much cleaner code than listening for a change event and calling setStyle in the handler (though that's what happens internally).

This trivial-looking feature involved delving into the MXML compiler source, and that's what inspired me to write about keep-generated-as a few months ago.

I'll try to write about the new enhancements in Flex 2 as I find time in between attending sessions at the conference. Stay tuned!

Read: Styles and binding

Topic: Leonardo for John. Previous Topic   Next Topic Topic: Leonardo on home intranet

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use