Challenges,
Halo - clunky
Non standard tricky CSS syntax
Heavy visuals
Scale 9 limitations
Dive into drawing API
“ time for a change captain..”
Degrafa,
Declarative Graphics Framework
Community driven
Open Source (MIT License)
Approaching 1.0 release
http://degrafa.org
What is Degrafa?
Create graphics via MXML
Easier than using drawing API directly
Reduce / eliminate external assets
Very powerful
Retain control & precision
Bindable properties
“not just lls and strokes! ”
How does it work?
You need something to draw onto
Surface - extends UIComponent
or MXML component like:
or advanced CSS using CSSSkin
What can it do?
Draw shapes
<degrafa:Circle radius="30" />
Fills - solid, gradient, bitmap, blends
<degrafa:SolidFill color="#FF0000" />
Transformations
<degrafa:RotateTransform registrationPoint="center" angle="45" />
Simple example,
Draw a red circle on screen:
<degrafa:Surface>
<degrafa:fills>
<degrafa:SolidFill id="redFill" color="#FF0000"/>
</degrafa:fills>
<degrafa:GeometryGroup>
<degrafa:Circle radius="50" fill="{redFill}"/>
</degrafa:GeometryGroup>
</degrafa:Surface>
De ne,
In CSS we set the skin class:
.preItem {
borderSkin: ClassReference("skins.PreItemPanel");
}
Going forward,
Axiis - Data visualisation
Birdeye - Visual analytics
Becoming a ‘super set’ to FXG
Union, punch & join
Decouple from Flex - AS version
Fix bugs & optimisation
Spark & Flex 4,
New component architecture
Skin separate to behaviour
Extended States model
Metadata key to new architecture
Use of FXG for visual creation
What is FXG?
Declarative graphical tag library
XML based
Primitives, text, transformation
Interchange format - Catalyst & CS
Mirrors FP10 rendering model
Simple example,
Draw a red circle on screen:
<s:Graphic>
<s:Group>
<s:Ellipse width="100" height="100">
<s:fill>
<mx:SolidColor color="#FF0000" />
</s:fill>
</s:Ellipse>
</s:Group>
</s:Graphic>
What skin?
Associate component with skin (CSS):
Button {
skinClass: ClassReference('spark.skins.default.ButtonSkin")
}
or inline:
<s:Button skinClass="skins.PreButton" label="Button"/>
CSS Namespaces,
Watch your namespaces
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/halo";
/* Use S namespace for Spark component */
s|Button { skinClass: ClassReference('skins.PreSkin') }
/* Use MX namespace for Halo component */
mx|Label { color:#FF0000; }
Skin parts,
Components identify the
Required or optional skin part elements
States,
Extended from MXML.
Better for skin development
<s:states>
<s:State name="up"/>
<s:State name="over"/>
<s:State name="down"/>
</s:states>
<s:GradientEntry color="#858585" color.over="#F7F7F7" ratio="0" alpha="0"/>
HostComponent,
Metadata link to component
<fx:Metadata>[HostComponent("spark.components.Button")]</fx:Metadata>
To get properties of skin’s host
No code hinting in IDE yet
<SolidColor color="{hostComponent.backgroundColor as uint}" />
Halo & Spark,
Can co-exist
Use CSS Namespace
Skin Halo by extending SparkSkin
Halo navigators must have Halo
container as child
Round up,
Degrafa
easy to use, renders well,
data visualisation extensions
Not fully integrated, still beta
FXG
Catalyst & CS Suite will aide creation
integrated with FP10
lacking some extra of Degrafa
Homework,
Presentation material and code
http://jameswhittaker.com
Thank you,
Hopefully you’ve learnt a little!
Visit RefreshingApps.com for some AIR!
Come and grab a Moo card opps sorry!
My session notes from Flash Midlands in Birmingham more
My session notes from Flash Midlands in Birmingham (UK) 16th June 2009.
An introduction to declarative graphics and skinning for Flex applications using Degrafa and the new FXG format. less
0 comments
Post a comment