开发者

Porting Silverlight app to Flex

Perhaps a dumb question, but if you write a relative simple 2D game in .NET (e.g. for Silverlight) C# and you want to port it to Flex - just because you know C# and don't want to bother with other language, are there any means to facilitate this porting process?

Let's suppose that we are using FRAME BASED deve开发者_运维问答lopment (as Flash is, opposed to TimeLine in Silverlight) using the CompositionTarget.Rendering event.

I pose this question because I would like to try to create a fully functional app in .NET and then port it to Flex.


No, there is no direct way to do this, unfortunately. This is unfortunate, because Silverlight and Flex are so insanely similar to each other. Pretty much every feature in either has an analog in the other... but the language (AS3 vs C#) and the UI declaration (MXML vs XAML) is different in both platforms.

You can consider using MVVM for the majority of your behavior logic along with some good unit tests. Port the unit tests over to AS3 and get your MVVM code rocking using "Presentation Model" in Flex. Then, convert the UI using brute force.

Some resources to get you moving forward:

  • C# to AS converter: http://cs2as.codeplex.com/
  • C# to AS3 converter: https://code.google.com/p/cstoas3/
  • C# to Haxe converter: http://cs2hx.codeplex.com/
  • Visual Studio plugin for Flex: http://www.ensemble.com/products/tofino.shtml
  • A series (in development) about cross-training in SL & FLex: http://houseofbilz.com/archives/2010/10/24/cross-training-in-silverlight-vs-flex/
  • An example using Presentation Model: http://riarockstars.com/2011/03/16/presentation-model-and-multiple-screens-part-1/

Good luck, and make sure to blog about what you've learned about doing this. I am VERY interested to see someone do it.


I've not seen anything for this. The languages/platforms feature nothing in common so any converter would basically be brute force. Unless someone has taken the time to create a converter (doubt it), you're going to have to do it manually.

Of course, that's just a presentation tier. You could conceivably build all the logic as services and have a .net engine underlying the Flex presentation like you would any flex or silverlight app that relied on a separate service tier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜