A while back I was looking for a canned media player widget for a Flex/AIR app I was fooling with and found this pretty cool dev center sample: Flex 3 Media Widget (the previous incarnation of this was available on labs here)
What made it even cooler were the source files it had for dealing with RSS and MediaRSS feeds.
I was starting to work on a new sample that needed to read RSS and remembered the aforementioned project, but couldn’t remember where I had gotten the RSS libraries from. I figured I would write this blog entry, so next time it will be easier for me to remember.
You can view the source of the app here:
http://examples.adobe.com/flex3/devnet/mediawidget/srcview/
and download a zip here: http://examples.adobe.com/flex3/devnet/mediawidget/srcview/MediaWidget.zip
There is an AS3 library at: http://code.google.com/p/as3syndicationlib/, but I believe the code with the MediaWidget is newer, plus it contains MediaRSS parsing classes. Woot!
No Comments »
I have a few samples I am working on to demonstrate how to do some “drag selection” and I thought some of the base code I use in these samples would be good to post on its own.
So here it is. Pretty basic, but it will serve as the basis for a few samples that I should have out next week (hopefully).
This movie requires Flash Player 9
Download a zipfile containing the source to this sample.
Browse the source of this example.
Or continue into the blog entry to see the source:
Read the rest of this post»
2 Comments »
I had someone ask me a while back how they could set the background color for the “SMTWTFS header” in the calendar control. This is not built in functionality, but really not that hard to do.
In fact, I found 2 different approaches. The first is below, the second, I will post in a few days after I clean up the code a bit.
(I would like to point out that this is just an approach and may not be production ready code.)
This movie requires Flash Player 9
Download a zipfile containing the source to this sample.
Browse the source of this example.
Or continue into the blog entry to see the source:
Read the rest of this post»
2 Comments »
The datachooser control doesn’t expose a way to disable the individual year up/down arrows, only the entire year Navigation (via yearNavigationEnabled).
But in looking at the internals of the dataChooser.as class you can get at the Buttons in an unsupported way.
mx_internal var upYearButton:Button;
mx_internal var downYearButton:Button;
These are the mx_internal scoped buttons for the up/down year.
You could technically extend the datechooser class and then create methods to enable/disable these buttons (if they exist).
Then you could enable/disable them using logic based on what you are setting for selectable ranges.
This is what I have done in the following example
This movie requires Flash Player 9
Download a zipfile containing the source to this sample.
Browse the source of this example.
Or continue into the blog entry to see the source:
Read the rest of this post»
1 Comment »
I have used mx_internal a few times, but in between my instances of use, forget exactly what I have to do to use it. Here is a link to a good blog article that describes what to do.
No Comments »
E4X is a very powerful and easy way to manipulate xml data in Flex.
Of course something so p[powerful can sometimes be confusing when it produces unexpected results.
<mx:XML format="e4x" id="myXML">
<order>
<item id=‘1′>
<menuName>burger</menuName>
<price>3.95</price>
</item>
<item id=‘2′>
<menuName>fries</menuName>
<price>1.45</price>
</item>
</order>
</mx:XML>
If you wanted to retrieve the price of the burger menuitem above, it is easily done with the e4x expression:
<mx:XML format="e4x" id="myXML">
<order>
<item id=’1′>
<menuName>burger</menuName>
<menuName>burger</menuName>
<price>3.95</price>
</item>
<item id=’2′>
<menuName>fries</menuName>
<price>1.45</price>
</item>
</order>
</mx:XML>
Then if you used the same expression, you actually would not get a value returned.
It is not obvious as to why this happens, but of course there is more than one way to skin a cat…
Here is an expression that will work:
myXML.item.menuName.(text()=="burger").parent().price;
Here is a link to a Flex Builder 2.0.1 project (compiled with SDK hotfix1) containing a sample demonstrating the solution described above.
No Comments »
If in the dataGrid control you set showHeader = false and if the dataProvider has no items in it, then the vertical column lines don’t show up.
The vertical column separator lines only appear when the dataProvider has items populating the grid (or if there is no data and showHeader=true).
In the Datagrid code, drawing the vertical column separator lines is keyed off of the listData, which would have a “row 0†containing the header row if the headers where to be visible.
The solution to this is to extend the datagrid and override the drawLinesAndColumnBackgrounds method in which you can iterate over the column array rather than the listItems to draw the vertical lines.
Read the rest of this post»
No Comments »
This is installment 3 in the series.
The previous 2 related posts are:
Changing embedded True Type fonts at Runtime in Flex Applications
Using Modules to Change embedded True Type fonts at Runtime in Flex Applications
This approach is a little different.
The application is very similar, but instead of using a loader or module loading, I use the StyleManager to load a runtime CSS swf (which was compiled from a CSS file).
Here is one of the style sheets that is tuned into a CSS swf:
/* CSS file */
@font-face {
src
:url("assets/arial.ttf");
fontFamily: myFont;
}
@font-face {
/* Note the different filename for boldface. */
src:url("assets/arialbd.ttf");
fontFamily: myFont; /* Notice that this is the same alias. */
fontWeight: bold;
}
@font-face {
/* Note the different filename for italic face. */
src:url("assets/ariali.ttf");
fontFamily: myFont; /* Notice that this is the same alias. */
fontStyle: italic;
}
@font-face {
/* Note the different filename for bold-italic face. */
src:url("assets/arialbi.ttf");
fontFamily: myFont; /* Notice that this is the same alias. */
fontWeight: bold;
fontStyle: italic;
}
.myPlainStyle {
fontSize: 11;
fontFamily: myFont;
}
.myBoldStyle {
fontSize: 11;
fontFamily: myFont;
fontWeight: bold;
}
.myItalicStyle {
fontSize: 11;
fontFamily: myFont;
fontStyle: italic;
}
.myBoldItalicStyle {
fontSize: 11;
fontFamily: myFont;
fontWeight: bold;
fontStyle: italic;
}
Read the rest of this post»
2 Comments »
This is really part 2 in the series. Part 1 was Changing embedded True Type fonts at Runtime in Flex Applications
The interface that I have each font swf implementing is the same, so I have not posted the code.
The application has undergone some slight refactoring and I have added a few things.
I chose to use the ModuleManager.getModule(url) rather than using the mx:ModuleLoader tag.
The module Manager was more flexible and really should be used for loading non-visual modules.
Note the way that you get access to the loaded module after it has loaded:
var ml:IModuleInfo = e.target as IModuleInfo;
loadedFont = ml.factory.create()as IFontModule;
Read the rest of this post»
No Comments »
Recent Comments