<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2008://34.24009-</id>
  <updated>2009-11-05T20:06:15Z</updated>
  <title>Comments for An Introduction to OpenFlux (http://www.insideria.com/2008/06/getting-started-with-openflux.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2008://34.24009</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=24009" title="An Introduction to OpenFlux" />
    <published>2008-06-19T16:00:00Z</published>
    <updated>2008-06-30T16:12:00Z</updated>
    <title>An Introduction to OpenFlux</title>
    <summary>As a Flex developer, one of the most valuable skills you can learn is custom component development. Although a lot of the training and information that&apos;s available for Flex focuses on how to use existing components, the truth is that memorizing every property of every Flex component isn&apos;t all that important. Eventually you&apos;re going to need custom graphics or functionality that no one ever anticipated, and this is where OpenFlux is going to make your day.</summary>
    <author>
      <name>Ben Stucki</name>
      <uri>http://blog.benstucki.net</uri>
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<p>As a Flex developer, one of the most valuable skills you can learn is custom component development. Although a lot of the training and information that's available for Flex focuses on how to use existing components, the truth is that memorizing every property of every Flex component isn't all that important. Eventually you're going to need custom graphics or functionality that no one ever anticipated, and this is where OpenFlux is going to make your day.</p>

<p>OpenFlux is an open-source component framework for Flex which makes custom component development fast and easy. To get started you'll need to download the SWC files provided on the project homepage <a href="http://openflux.googlecode.com">http://openflux.googlecode.com</a> or <a href="http://code.google.com/p/openflux/source/checkout">grab the source code</a> from our public SVN. Then, copy the compiled SWC files into the libs folder of your Flex project.</p>

<p>Once your project references the OpenFlux SWC, simply declare the namespace "<em>http://openflux.googlecode.com</em>" in your application or component to use the framework.</p>

<div class="acode" style="overflow: auto; padding: 10px;" >
 <div style="overflow;x:visible;">
  <code language="perl">
<pre>
&lt;mx:<span class="category2">Application</span> xmlns:mx="<span class="quote">http://www.adobe.com/2006/mxml</span>" 
	xmlns:flux="<span class="quote">http://openflux.googlecode.com</span>" layout="<span class="quote">absolute</span>"&gt;
  
  &lt;flux:<span class="category2">Button</span> <span class="category1">label</span>="<span class="quote">Button Example</span>" left="<span class="quote">20</span>" top="<span class="quote">20</span>" /&gt;
  
&lt;/mx:<span class="category2">Application</span>&gt;
  </pre>
</code>

 </div>
</div>
<div>ButtonExample1: <a href="http://openflux.googlecode.com/svn/demos/ButtonExample1/ButtonExample1.html">example</a> | <a href="http://openflux.googlecode.com/svn/demos/ButtonExample1/srcview/index.html">source</a></div>
<p/>
<p>As you can see, OpenFlux components work a lot like the normal Flex components that you're used to using. You can define properties inline, bind values, and listen to events dispatched by the component. However there is one fundamental difference in the way that OpenFlux components work. In the OpenFlux framework each component has reassignable <em>view</em> and <em>controller</em> properties, and the objects assigned to these properties are responsible for the component's display and behavior respectively.</p>

<p>In the example below I've assigned a custom view to the Button component so that it looks like a checkbox. I'm also defining the controller inline so that I can set it's <em>selectable</em> property to true.</p>

<div class="acode" style="overflow: auto; padding: 10px;" >
 <div style="overflow;x:visible;">
  <code language="perl">
<pre>
&lt;mx:<span class="category2">Application</span> xmlns:mx="<span class="quote">http://www.adobe.com/2006/mxml</span>" 
	xmlns:flux="<span class="quote">http://openflux.googlecode.com</span>" layout="<span class="quote">absolute</span>"&gt;
  
  &lt;flux:<span class="category2">Button</span> <span class="category1">label</span>="<span class="quote">Button Example</span>" left="<span class="quote">20</span>" top="<span class="quote">20</span>"&gt;
    
    &lt;flux:view&gt;
      &lt;flux:CheckBoxView /&gt;
    &lt;/flux:view&gt;
    
    &lt;flux:controller&gt;
      &lt;flux:ButtonController <span class="category2">selectable</span>="<span class="quote">true</span>" /&gt;
    &lt;/flux:controller&gt;
    
  &lt;/flux:<span class="category2">Button</span>&gt;
  
&lt;/mx:<span class="category2">Application</span>&gt;
  </pre>
</code>

 </div>
</div>
<div>ButtonExample2: <a href="http://openflux.googlecode.com/svn/demos/ButtonExample2/ButtonExample2.html">example</a> | <a href="http://openflux.googlecode.com/svn/demos/ButtonExample2/srcview/index.html">source</a></div>
<p/>
<p>It's possible to use any custom view or controller with a component and even bind to the properties or styles which may be specific to the view or controller class. That's an important capability, but in some cases you may want a simpler way to assign these values.</p>

<p>In the next example, I've used CSS to define a set of values for components with a styleName of checkbox. By using CSS I can easily seperate all of the visual and behavioral settings from the application wiring and API. It also let's me reuse common settings across multiple components.</p>

<div class="acode" style="overflow: auto; padding: 10px;" >
 <div style="overflow;x:visible;">
  <code language="perl">
<pre>
.checkbox {
 	<span class="category2">selectable</span>: <span class="category1">true</span>;
 	view: ClassReference("<span class="quote">com.openflux.views.CheckBoxView</span>");
}
  </pre>
</code>

 </div>
</div>

<div class="acode" style="overflow: auto; padding: 10px;" >
 <div style="overflow;x:visible;">
  <code language="perl">
<pre>
&lt;mx:<span class="category2">Application</span> xmlns:mx="<span class="quote">http://www.adobe.com/2006/mxml</span>" 
	xmlns:flux="<span class="quote">http://openflux.googlecode.com</span>" layout="<span class="quote">absolute</span>"&gt;
  
  &lt;mx:Style source="<span class="quote">css/button_example_3.css</span>" /&gt;
  &lt;flux:<span class="category2">Button</span> <span class="category1">label</span>="<span class="quote">Button Example</span>" left="<span class="quote">20</span>" top="<span class="quote">20</span>" styleName="<span class="quote">checkbox</span>" /&gt;
	
&lt;/mx:<span class="category2">Application</span>&gt;
  </pre>
</code>

 </div>
</div>
<div>ButtonExample3: <a href="http://openflux.googlecode.com/svn/demos/ButtonExample3/ButtonExample3.html">example</a> | <a href="http://openflux.googlecode.com/svn/demos/ButtonExample3/srcview/index.html">source</a></div>
<p/>
<p>I hope that the examples in this post help demonstrate the benefits of working with OpenFlux and give you a solid starting point for using the framework in your own projects. In a future post I'll show you how to use Degrafa with OpenFlux to create custom component views. Until then, please <a href="http://openflux.googlecode.com">download OpenFlux</a>, join the <a href="http://groups.google.com/group/openflux?hl=en">mailing list</a>, and let us know what you think!</p>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018037</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018037" />
    <title>Comment from Sean Christmann on 2008-06-19</title>
    <author>
        <name>Sean Christmann</name>
        <uri>http://www.craftymind.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.craftymind.com">
        <![CDATA[<p>Any chance you could link the swfs generated by your example code?</p>]]>
    </content>
    <published>2008-06-19T17:39:39Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018045</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018045" />
    <title>Comment from Andre Charland on 2008-06-19</title>
    <author>
        <name>Andre Charland</name>
        <uri>http://blogs.nitobi.com/andre</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://blogs.nitobi.com/andre">
        <![CDATA[<p>this looks really cool.  nice to have an easy frameworks to start building Flex components going.  keep us posted on cool new UI components built on top of this framework.</p>]]>
    </content>
    <published>2008-06-19T21:48:07Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018058</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018058" />
    <title>Comment from Vladimir Tsvetkov on 2008-06-20</title>
    <author>
        <name>Vladimir Tsvetkov</name>
        <uri>http://npacemo.com/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://npacemo.com/">
        <![CDATA[<p>The idea has been around for a while and I'm glad to see a framework that will make this kind of micro mvc's even more popular. <br />
I have two questions though... <br />
1. Which is the most basic component in OpenFlux. Is there an analog with the 'bare bone'  UIComponent, just like the sample with the Button - can I start with a component that's really basic and not a button or other component from the Flex set of UI controls? <br />
2. Is the framework supporting not just view and controller, but also a model which these two can use? Something like:<br />
<pre>&lt;flux:Button&gt;<br />
    &lt;flux:view&gt;<br />
        &lt;flux:CheckBoxView /&gt;<br />
    &lt;/flux:view&gt;<br />
    &lt;flux:controller&gt;<br />
        &lt;flux:ButtonController selectable="true" /&gt;<br />
    &lt;/flux:controller&gt;<br />
    &lt;flux:model&gt;<br />
        &lt;flux:ButtonModel /&gt;<br />
   &lt;/flux:model&gt;<br />
&lt;/flux:Button&gt;</pre><br />
So you can store data and state information inside. <br />
Very nice and brief article!</p>]]>
    </content>
    <published>2008-06-20T14:58:41Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018193</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018193" />
    <title>Comment from Ben Stucki on 2008-06-22</title>
    <author>
        <name>Ben Stucki</name>
        <uri>http://blog.benstucki.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://blog.benstucki.net">
        <![CDATA[<p>Vladimir, You're absolutely right, and those are some great questions. Here are a few quick answers for you.</p>

<p>1. Yes, the FluxComponent is the most basic component in OpenFlux and is analogous to Flex's UIComponent. You could also implement IFluxComponent if you're feeling especially adventurous.<br />
2. No, the framework uses the component itself as the model. Because the view and controller functionality have been abstracted out (along with all their related properties and styles), the only API of the component besides the boiler-plate MVC coordination should constitute that components model. We've definitely considered a structure like you've suggested, but found that it over-complicates usage of the components in MXML applications.</p>]]>
    </content>
    <published>2008-06-22T20:01:17Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018268</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018268" />
    <title>Comment from ramana on 2008-06-25</title>
    <author>
        <name>ramana</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>How to configure openflux with flashdevelop</p>]]>
    </content>
    <published>2008-06-25T10:20:51Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2018408</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2018408" />
    <title>Comment from Aldo Bucchi on 2008-06-30</title>
    <author>
        <name>Aldo Bucchi</name>
        <uri>http://aldobucchi.com/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://aldobucchi.com/">
        <![CDATA[<p>True.. a separate model messes up with the ability to set properties in MXML.</p>

<p>But... one reasonable use case for having a separate model is to <br />
connect it to more than one view/controller at the same time. Which is quite a powerful use case.</p>

<p>Conceptually it shouldn't be hard to tweak OpenFlux to allow this... off the top of my head:</p>

<p><i>The complete bundle... MVC</i><br />
<pre><br />
&lt;flux:Button id="btn"/&gt;<br />
</pre></p>

<p><i>Additional V and C, hooked to the previous M</i><br />
<pre><br />
&lt;flux:VC model="{btn}" view="{ButtonView2}" controller="ButtonController2"/&gt;<br />
</pre></p>

<p>Or something like that.<br />
Great article ;)</p>

<p>Best,<br />
A</p>]]>
    </content>
    <published>2008-06-30T08:17:35Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.24009-comment:2049315</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.24009" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/06/getting-started-with-openflux.html#comment-2049315" />
    <title>Comment from Neeraj on 2008-12-21</title>
    <author>
        <name>Neeraj</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Hi,</p>

<p>I am Neeraj ,recently join this group..<br />
it's rally cool to see this type of framework .<br />
this is really helpful for developer and time saving..</p>

<p>Thanks<br />
Neeraj</p>]]>
    </content>
    <published>2008-12-21T19:47:27Z</published>
  </entry>

</feed
