Build Your Own IPhone RSS Reader in 15 Minutes With Flash Builder

by Ibrahim Ersoy 5. February 2012 21:23
In this article we will build a RSS Reader using Xml Data Service in Flash Builder for an iPhone 4 Application (you can change which mobile OS is to be used from the project's properties). To develop this application you should follow the following steps.

Step 1 : First of all create a new Flash mobile application which supports iPhone 4.
Step 2 : Create Tabbed Application add one Tab.
Step 4 : Add RichEditableText and List controls from the toolbox.
Since RichEditableText wont be seen on Toolbox add it by using code in mxml:

<s:RichEditableText editable="false" id="ret" x="0" y="186" width="321" height="175" clipAndEnableScrolling="true" fontFamily="Georgia" fontSize="8">
The application will look like.

1.jpg

Now we need to connect to an Xml file of our blog. Follow the steps:
First click on Data->Connect to Xml.

2.jpg



Select Xml Service Type.


4.jpg


Then choose URL section and give your blog's x
ml location.



5.jpg

Here as an URL I gave my blog's feedburner link. Because I used Blogengine and it didn't accept my syndication file, I had to burn my blog on Google's FeedBurner which was a life-saver in this situation :)

Later click on "invoke" button to get nodes from your xml file.
Click Finish!

Now click->Window->Data/Services to Bind Data to our List control.

7.jpg
Just Drag getData operation over List and then drop it!
7.jpg
A new Dialog Window will appear asking you to choose on details.

8.jpg


Our service is called iersoyco
m as you can remember. The Label field contains the texts that will be displayed in the List control. Because we want to view the Titles of the Blog here.
Click Ok to finish.
Now automatically some code has been added to our project. Update the "list_creationCompleteHandler" function just like that:
protected function list_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = iersoycom.getData("title");
}

Now let's run the project to see if we get RSS titles.


9.jpg

Ok we got them.
The next that we will be doing is adding another operation to view the Content. Add a Service again (as we did above).


10.jpg


Select the Node description and check "is Array?"; rename the service name to "descs" which we will be using here. Again open up the Data/Services window and drag the last created operation on the RichEditableText.Some codes will be again automatically added.
Update your service.

getDataResult2.token = descs.getData(
"description");
Now it's time to add a function to reverse List items. I will tell you later why I did this. Before adding the function add these namespaces.

import mx.events.FlexEvent;
import
mx.events.CloseEvent;
import
mx.events.FlexEvent;
import
spark.events.IndexChangeEvent;
import
flashx.textLayout.conversion.*;
import
flashx.textLayout.formats.*
import
flashx.textLayout.elements.*




Update list_creationCompleteHandler function.

protected
function list_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = iersoycom.getData(
"title");
getDataResult2.token = descs.getData(
"description");
}




Add a new function that reverses index of list.
private function Changeit(event:IndexChangeEvent):void
{

var
selIndices:Vector.<int> = event.currentTarget.selectedIndices;
var
selItems:Vector.<Object> = event.currentTarget.selectedItems;
var
numItems:Number = selIndices.length;
getDataResult2.token = descs.getData(
"description");
var
importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_FIELD_HTML_FORMAT);
ret.textFlow=importer.importToFlow(getDataResult2.lastResult[list.selectedIndex]);

}




The first three codeline reverses index numbers. The latest codes are for importing the content from the blog. Normally if you use TextFlow on his own, it will suspect it's a plain content receiving the feed. So we need to add "Html Format converter" to view html markup tags. According to the selectedindex we will bind content information of the feed. Why do we do this? Because when it adds new items in the list the first index is 11 (that's my blog post count). So to apply the the selectedindex method we need to first reverse the list control.

Your mxml file should look like this; check it before running RSSReader.

<?xml version="1.0" encoding="utf-8"?>
<s:View
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="
library://ns.adobe.com/flex/spark"
xmlns:iersoycom="
services.iersoycom.*"
xmlns:descs="
services.descs.*"
title="
RSS">
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<iersoycom:Iersoycom id="iersoycom"/>
<s:CallResponder id="getDataResult2"/>
<descs:Descs id="descs"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import spark.events.IndexChangeEvent;
import flashx.textLayout.conversion.*
import flashx.textLayout.formats.

import flashx.textLayout.elements.*
private function Changeit(event:IndexChangeEvent):void
{

var selIndices:Vector.<int> = event.currentTarget.selectedIndices;
var selItems:Vector.<Object> = event.currentTarget.selectedItems;
var numItems:Number = selIndices.length;
getDataResult2.token = descs.getData(
"description");
var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_FIELD_HTML_FORMAT);
ret.textFlow=importer.importToFlow(getDataResult2.lastResult[list.selectedIndex]);
}
protected function list_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = iersoycom.getData(
"title");
getDataResult2.token = descs.getData(
"description");
}
]]>
</fx:Script>
<s:List change="Changeit(event);" id="list" x="0" y="0" width="320" height="155" borderColor="#FF0000" borderVisible="true"
creationComplete="list_creationCompleteHandler(event)" fontFamily="
Georgia" fontSize="8"
labelField="
title">
<s:AsyncListView list="{getDataResult.lastResult}"/>
</s:List>
<s:RichEditableText id="ret" x="0" y="163" width="321" height="198" clipAndEnableScrolling="true"
editable="
false"
fontFamily="
Georgia" fontSize="8"/>
</s:View>



11.jpg



That easy!

Tags: , , , ,

Flash Builder(FLEX) | iPhone/iPad

Image Based Text Effect in Windows Phone 7

by Ibrahim Ersoy 5. February 2012 21:21

Introduction

In this article we will understand the Image based Text Effect on Windows Phone 7. Ever wonder how to add a gradient-like effect but as an image?

Let us see how to do that.

Step 1 : First of all we need to create a new project for Windows Phone 7 (I preferred that) import this image below in your application.

Google Buzz icon

social_google_buzz_button_256.png

Step 2 : In this step you need to add a label to your project.

1a.png

Step 3 :
Now change its Foreground value to get the image we've imported above.

2a.png

Step 4 : Change Stretch into UniformToFill to get a better view. Here's what we've achieved:

3a.png

Hope its an useful trick for you :)

Tags: ,

Visual Studio 2010 | Windows Phone 7

Tabbed Applications in Flash Builder(iPhone)

by Ibrahim Ersoy 1. February 2012 22:44

As said above if you're interested in creating your own iPhone Applications you will just love it!


In Flash Builder while creating new project type,it gives us option how the application will look like.


It can be whether empty(you can fill it on your own),View-Based & Tabbed Applications.


1.png

You can also Add Tabs automatically here to get started immediately(Home-Products-About-Contact)

In general View-Based and Tabbed Applications are the same.Except visual difference,in View-Based Applications you write your own code for transitions as we did in our previous article
Transitions in Flash Builder(iPhone) Applications. But in Tabbed Applications every Tab is view-based so you'll only need to Edit these views.



3.png


Its so easy edit these Views.Just grab some Controls from ToolBox and drop it on the view:


4.png



If you havent configured already,Flash Builder runs its own Configurator on which Mobile OS your application will work at(There can be iOS-iPhone,iPad,Android and BlackBerry)

2.png



You can emulate it on a emulator or real device.its your choice! But after development ended use it on a real device for testing purposes on production.


Tabbed-Applications use TabbedViewNavigator control and Flash Builder enables Nested Tabs in our applications.I will write another article explaining this control further.After adding additional Tabs.Flash Builder adds new Views automatically.So it will be quite easy for your developments.See the image below for example:


5.png




Hope that Tabbed Applications will be much useful for you.

Tags: , , , ,

Flash Builder(FLEX) | iPhone/iPad

Transition in Flash Mobile Applications

by Ibrahim Ersoy 31. January 2012 00:34
Sorry i was fulfilling my army service a couple of months,so couldnt write a single post!
 
Last night i was doing some app at Flash Builder 4.6 .And stuck in a point about transitions in an iOS application.
Instead i could have used Add-Delete View plan, i tried another:


navigator.pushView(YourViewNameWithoutExtension);




We have 2 mxml page in our app.

iMediaHomeView and Facebook for example.

 
 
FaceBook.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
		xmlns:s="library://ns.adobe.com/flex/spark"
		actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"
		title="Facebook">
	
	
	<fx:Script>
		<![CDATA[
			
			function GetBack()
			{
				navigator.pushView(iMediaHomeView);
			}
			
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Button x="25" y="734" label="All Sites" color="#000000"/>
	<s:Button x="515" y="735" label="Exit" color="#030303"/>
	<s:Button x="289" y="734" label="Back" color="#000000" click="GetBack();"/>
</s:View>
iMediaHomeView.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
		xmlns:s="library://ns.adobe.com/flex/spark"
		actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"
		title="iMedia">
	
	<fx:Script>
		<![CDATA[
			
			
			function Show_Facebook()
			{
			navigator.pushView(Facebook);
			}
			
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
		<s:Image x="177" y="24" width="128" height="128" scaleMode="stretch" smooth="true"
			 smoothingQuality="high" source="assets/facebook.png" click="Show_Facebook_();"/>
		<s:Button x="515" y="735" label="Exit" color="#030303"/>
</s:View>
Let me show you the output images:













That way i found a way to wander between views.

Hope its useful for you,too.

Tags: , , ,

Flash | Flash Builder(FLEX) | iPhone/iPad

WP7 Skins Available Now!

by Ibrahim Ersoy 16. September 2011 01:28

Windows Phone 7 Skins for NOKIA N8 and SAMSUNG NEXUS GT are ready for download and trying!

 

 

 

 

 

 

Copy the WM7_Skin file and image files for each skins to:

 

For 32-bit: C:\Program Files\Microsoft XDE\1.0

For 64-bit: C:\Program Files (x86)\Microsoft XDE\1.0

 

There is no button added for emulator and when you design your app using Expression Blend or Visual Studio 2010,

you wont be able to see your skin here.

 

These skins are for XDE only.


Download it now and try! 

 

WP7 Skins.rar (1,60 mb)



Tags: ,

Windows Phone 7

Samsung Nexus GT Skin for Windows Phone 7 Emulator

by Ibrahim Ersoy 10. September 2011 18:11

Did you like it? I've just finished!






Well, Maybe Samsung Nexus GT doesnt support WP7 but it would be nice,it were! 

Dont you think?

 

 

Im making some skins for WP7.When they are all finished, i will be sharing them with you :)

 

Tags: ,

Windows Phone 7

How To Fix Emulator Problem in WP7.1

by Ibrahim Ersoy 8. September 2011 01:28

You've just installed Windows Phone 7.1 Developer Tools RC but you were unable to debug it.Right?


This is because some files are missing from your PC that Emulator needs.

Lets run Standalone Windows Phone Emulator and see which file it is!



 

 

See? MFPlat.DLL file is missing from your PC! This problem here isnt about running VS2010 as Administrator or not! I saw guys talking about this so often but they are focusing on the wrong direction :) The real problem here is: our emulator needs this MFPlat.DLL file.

So where to find it?

Dont worry i've Google'd around a bit for you and found the required files that will help you run WP7.1 Emulator properly.



First of all, download the archive file i'm giving you.

 

wp7reqfiles.rar (296,15 kb)

 



Now extract these files.

There are 3 folders: "C_Windows_System32" , "C_Windows_System32_en-US"  and "C_Windows_SysWOW64"


Copy the 3 files inside these directories into the same location as folder name given within archive file.



Furthermore:

1) Copy mfplat.dll inside "C_Windows_System32" folder into C:\Windows\System32 directory.
2) Copy mfplat.dll inside "C_Windows_SysWOW64" folder into  C:\Windows\SysWOW64 directory. (if you're using 32-bit Win OS, ignore this step)
3) Copy mfplat.dll.mui inside "C_Windows_System32_en-US" folder into C:\Windows\System32\en-US


After this step you're ready for WP7.1 Development!

 




Hope it helps! 

Tags:

Windows Phone 7

Read My Articles at CSharpcorner.com

by Ibrahim Ersoy 5. September 2011 02:42

I wrote more than 100 articles in MindCracker Communities.

You can read them here :

http://www.c-sharpcorner.com/Articles/ArticleListing.aspx?AuthorID=iersoy

 

 



Tags: ,

Announcements

Enabling DataSheet View in SharePoint 2010

by Ibrahim Ersoy 5. September 2011 02:26

You may have noticed that if you create a List or Library and want to view them on SharePoint 2010, then even though you've installed Office 2010 64-bit, it won't display the items in DataSheet View.


 

That's because you haven't installed 32-bit Office 2010 in the Client Machine. If you're on a development environment or don't want to install Office 2010 32-bit version on a 64-bit platform then you will have to install "2007 Office System Driver: Data Connectivity Components" or "Microsoft Access Database Engine 2010 Redistributable" which also enables DataSheet View in SharePoint Portal.

 

 

DataSheet works like an Access application. So it would be easy for you to record items in your lists or libraries.

Reminder:
DataSheet is an ActiveX control so it would work with only Internet Explorer.


Tags: ,

SharePoint 2010

Computed Columns in SQL Server 2008

by Ibrahim Ersoy 5. September 2011 02:18

Tables can have computed columns. It is an expression defining the value of the specified column. If you are creating a table object in Query Window the columns don't have data by default. But using the Computed Columns method you can fill data as you like.

Lets make an example for it. Assuming you have a database named SampleDatabase, write a query:

 

Use SampleDatabase;
GO
Create Table ComputedColumns
(
Quantity int NULL,
Cost money NULL,
Investment as (Quantity * Cost)
);

 

We're creating a table named ComputedColumns and setting 3 columns "Quantity", "Cost" and "Investment"

Because of the multiply of Quantity and Cost will lead us to Investment costs, it would be useful if we define Investment as variable storing the data of multiplication of these 2 variables.

Because if there's no variable defined for Investment, you won't be able to insert any datas manually. Its data will be calculated and recorded after you passed it.

 Lets see the results:

******** Added "2" in the Quantity Column ********

 

******** Added "1.000" in the Cost Column *******


 

******** You cant add any data into Investment column, so you passed ******

 


 

 

After this process, it automatically calculates the data as you can see.

 
Hope this helps

 

Tags: , ,

SQL Server 2008 R2