While working on a presentation about Native Windows & Adobe AIR I ran into the Screen class. The screen object provides information about the display screens available to an application allowing you to position applications/windows on different screens. I say screens and not monitors because of a little caveat that the livedocs have in them:
Note that there is not necessarily a one-to-one correspondance between screens and the physical monitors attached to a computer. For example, two monitors may display the same screen.
I thought I'd have a little fun to get my code fingers back after a week in Cabo San Lucas, and create a little AIR app that identifies each screen. The basics are:
Identify the Screens - I knew I had 2 screens, so that was easy. The screens property is an array of Screen objects, so you can work with as many as the user has.
Create something to identify the windows - I used transparent windows with a label to make things simple.
Ely Greenfield has posted a flip book example component that he put together for 360Flex.
Ely always puts together some pretty amazing stuff, this is no exception. Check it out on his blog.
TWO: If you are are expecting a response, use the sendAndLoad() method. You will need to create an XML object to catch the response from your server. The sendAndLoad() method takes 3 parameters:
url - where to send the XML
target - The XML object that receives the downloaded data (this can also be a LoadVars object depending on the data that is returned from the service)
method - GET or POST HTTP protocol. This parameter is optional.
Now what happens if you don't expect a response from the server? Do you use send()? Not if you don't want the page to redirect.
The send() method can GET or POST your XML data to a page, but your Flash piece page is expected to redirect. So, what do you do. Well, just use sendAndLoad() and create a dummy XML object for the 2nd parameter. You won't receive a response, but the XML will be sent to the server just the same.
I whipped up a quick Singlton to progamatically create bindings between two controls:
All you need to do is import the class and then call the addBinding() method on the REBinding Singleton class: import com.re.data.REBinding;
REBinding.getInstance().addBinding(src_txt, dest_txt, "text", "change");
Becareful when you mix series types in the Flex 2 (BETA 2) Charting Components. All of the documentation says that any chart that extends the CartesianChart can use other series types. This is true but you run into issues beacuse the chart tries to format the series data based on its chart type (makes sense, except we now what to combine series types).
For example if you had an <mx:ColumnChart> with a <mx:ColumnSeries> and <mx:LineSeries> , the chart would result in something like the following:
Notice how the line doesn't quite line up with the column chart.
If we change the <mx:ColumnChart> to an <mx:CartesianChart>, problem solved. The CartesianChart takes the data for what it is and doesn't try to shoehorn the series in to a specific display. Now check out the ColumnChart, the line series lines up with the column chart.
Update: It should be becareful what type of chart you use. Basically if you are mixing series types, then use the CartesianChart and you won't run into this problem. Basically what happened below is we tried to force data displayed as a line into a ColumnChart because we used the ColumnChart control. If you use the CartesianChart you won't have this problem. Thank you Ely!
I've been playing with the Flex 2 Charting components quite a bit latley.
The charting components include Bar, Column, Line, Area, Pie, Plot, HLOC (High/Low/Open/Close) & Candlesitck charts. That is quite a set of charts that allow you to visualize your data right out of the box.
Some of the cool features:
You can link up data to your charts and change the data at runtime based on user input, live data feeds etc.
Its pretty easty to create drag and drop charts with multiple data series for your chart.
Styling your chart is a no-braininer with CSS and inline in the MXML .
You can also extend the charts for your own custom charts.
Setting up the data is fairly straight forward using a HTTPService, RemoteObject or WebService tags with a Model tag.
I was working on a sample for label rotation and it turned out to be just a good general sample. So, I've posted it here.
FYI: In the current BETA release there is a little bug with label rotation. You have to embed a font to rotate the labels and when you do that, the ends of the label are cliped off. Adobe knows about the bug and hopefully it will be fixed.
This sample uses an to get an external XML file. Then I break the data into different models for the different charts. I've set up the bar chart to accept a click to update the selected 'company' and update the charts on the bottom (the ComboBox will do the same thing).
Check out the app here (you can right-click to view the source).
View the source here.
Macromedia announced the Flex Builder 2 Public BETA so I thought I'd play with it and see what I thought. I'm loving some of the new layout features they have added. It makes the initial layout so easy!Check out the list of features that have been added on the Adobe Labs site. Free Flex SDK Announcement!
As I was playing, I put this blog reader together in about 10 minutes.
Very simple, but very cool. It will read in an RSS 2.0 feed URL and let you cycle through the articles. You can choose from 3 pre-defined feeds ro enter your own. Oh yeah, this appwill only work locally bacuse it is reading in images and the flash crossdomain policy will get in the way.
I'm a senior developer at RealEyes Media, Adobe Certified Instructor and Adobe Certified Professional. Here you'll get my ideas and experience Flex, Flash, ColdFusion and related technologies as well as some generally off the wall stuff.