Archive for October 2006

Fixed - Service Capture + IE 7 + Flex Help

Months ago, Aral Balkan blogged about Service Capture not working with Flex Help and also gave a possible solution. (link) His solution was to uncheck ‘Modify IE Settings on Application Start/Stop”. Unfortunately for me, I didn’t want to uncheck that setting. I like that when I start Service Capture, it automatically sets up the proxy on open browser windows. Luckily, IE6 proxys traffic for “localhost” but doesn’t for 127.0.0.1. Flex Help is initially setup to run from 127.0.0.1, hence, missing Service Capture. Therefore, going into Flex Builder -> Preferences -> Help -> Help Server and making the Host Name: “localhost” and the Server Port: “57266″ allowed me to leave ‘Modify IE Settings on Application Start/Stop” checked and still use Flex Help. I was happy…

Fast Forward to yesterday, when I decided to upgrade to IE 7. Oh No! My Flex Help is gone again…wassup with that?! Well it turns out, IE 7 no longer proxys “localhost” nor “127.0.0.1″. So whats a fella to do? Hack! For some reason, “localhost.” (notice the period) is proxy’ed. Changing the Host Name in Flex Help Server to “localhost.”, a quick restart of Flex Builder, and all is well in my world once again!

Hope this helps someone!

Adobe Flex 2.0 + Cairngorm + Fluorine + ASP.NET Sample Application / Tutorial

After my last tutorial/post about using WebOrb, I began using Fluorine. Recently a request was made for a tutorial, so here goes…

Using Service Capture , an ABSOLUTELY fantastic tool and Fluorine with AMF3, still seems to be a problem. Also, I wanted to try and use the RemoteObject tag with my solution to make using .NET a little less coupled. Well, it turns out; Fluorine still seems to work great with AMF0, the remoting format from Flash 8. This led me to Renaun’s RemoteObjectAMF0 which easily plugs into a Cairngorm ServiceLocator. So there’s the pieces, now to put together the puzzle.

Renauns’s RemoteObject also works with AMF3. The reason I’ve been using AMF0 is that AMF3 + Fluorine doesn’t seem to display correctly in Service Capture. Possibly after I’m done developing my current project, I’ll switch this to AMF3 and see if any problems occur. You simply need to change the the line in RemotingConnection.as:

objectEncoding = ObjectEncoding.AMF0;
to:
objectEncoding = ObjectEncoding.AMF3;

First you will need the following for this tutorial: Visual Studio 2005, Adobe Flex Builder 2.0, Renaun’s RemoteObjectAMF0 (link), and Cairngorm (link), and Fluorine.

Open Visual Studio and Create a New Web Service: File -> New -> Website -> Empty Web Site.
Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeService.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.

A file EmployeeService.cs will be created in the App_Code Folder. Open EmployeeService.cs. Enter the following code.

[csharp]
using System;
using System.Web;

using net.shrefler.vo;

namespace net.shrefler.service
{
public class EmployeeService
{
public EmployeeService()
{
}

public EmployeeVO[] getEmployees()
{
EmployeeVO[] emps = new EmployeeVO[2];
EmployeeVO emp = new EmployeeVO();

emp.firstName = “Sam”;
emp.lastName = “Shrefler”;
emps[0] = emp;
emp = new EmployeeVO();
emp.firstName = “Your”;
emp.lastName = “Name”;
emps[1] = emp;

return emps;
}
}
}
[/csharp]

Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeVO.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.

A file EmployeeVO.cs will be created in the App_Code Folder. Open EmployeeVO.cs. Enter the following code.

[csharp]
using System;
using System.Web;

namespace net.shrefler.vo
{
public class EmployeeVO
{
public string firstName;
public string lastName;

public EmployeeVO()
{
}
}
}
[/csharp]

Next we’ll need to add Fluorine to our application. Add a “Bin” Folder to your Web Site. Right-Click on Bin and go to “Add Existing Item.” Browse to where you downloaded Fluorine and add “com.TheSilentGroup.Fluorine.dll”. Right click the root folder of your website and go “Add Reference”. Click the Browse tab, and add the “com.TheSilentGroup.Fluorine.dll” in your Bin folder.

Open web.config and add the following code.

[xml]




net.shrefler.vo.EmployeeVO
net.shrefler.vo.EmployeeVO






[/xml]

Next, create an empty Gateway.aspx file in the root of your website.

Finally, Rather than describing all the flex code: I decided to just use the Source View. So here is the flex code: (link)

I hope this helps everyone as much as I hope it will help me. As always, comments are appreciated. Good Luck!

Attention .NET + Flex Developers…Be Heard!

Following Graeme’s lead (I suggest reading his post), I also wanted to write a quick note to Adobe about the importance of .NET Developers…

A long time Coldfusion Developer, due to new employement, I find myself becoming an ASP.NET Developer. While not yet totally sold on the .NET Framework and often finding myself missing the convenience of Coldfusion, that is neither here nor there. The fact of the matter is, my company has too much investment (again, I’m not here to argue for or against this) in .NET to convince a move to Coldfusion. There is however, a void in the presentation of our application. Enter Flex.

From my previous work with Coldfusion and Flash, and having been led/heavily pushed toward Flex by Darron Schall, I’m now so grateful, I’ve been aware of Flex for quite some time. I waited and waited for Flex Builder 2 to be released. I jumped at the first opprotunity to incorporate it into my current .NET project.

I was met with reistance from co-workers due to them having NO knowledge of Flex.

No problem: I’ll just woo them with Examples of Flex being used with .NET.

Problem: I couldn’t find any.

Now, luckily, Flex examples, especially anything using the charting components, with a promise that I could utilize our .NET base was enough for me to get a chance, unfortunately, for some, I would guess they’ll have to pass on Flex. Also, I started to question, was I tricking myself…was it worth it…am I going to actually be able to do this based on what a couple of blogs say?

The resounding answer is YES! So far, utilizing Flex is wonderful and my company is over joyed seeing some of the things Flex can do. I love working with Flex.

So to answer Matt Chotin’s Question: The following is a little wish list, complete with a disclaimer of “Thank you Adobe for all you do. I love being a part of your developer community and I think the work you are currently doing is Fantastic!”

Adobe needs to help us .NET developers. We need to know we are cared for and loved. How about adding some .NET + Flex articles to the Adobe Developer Center. It would be an privaledge to help with something like that, the question is, are you interested Adobe, is there anything like this in the works?

Please educate me on Adobe’s stance on Fluorine (a tool that I highly recommend and that I’m using in all my projects). An article endorsing its use would make me feel great moving forward as a “Flex.NET” developer.

All of these things would combine to increasing the number of and the awareness of Flex.NET developers. As a current developer, it would motivate me to continue this amazing ride knowing that as the community grows, so will my demand as a Flex.NET developer rather than worrying about being left behind.

Again, Thank you Adobe for the Fantastic Work!

Using “Some “ActionScript expressions in curly braces - Data Binding

I seem to have come accross a little problem with the Logical Operator “&&” and Data Binding in MXML. It seems the MXML in Flex Builder doesn’t like the & character. Therefore, you get the following error when trying to bind an expression using the “&&” operator:

“The entity name must immediately follow the ‘&’ in the entity reference.”

An example of when this would be used would be if you are trying to bind the enabled property of a button:

[xml]

[/xml]

Therefore, you have two options as a solution

1:

You have to go back to De Morgan’s laws
(A && B) == ! (!A || !B)

Therefore, i can fix the first expression like so:

[xml]

[/xml]

Now you should be good to go.