Tuesday, August 25, 2009

How to use FCK Editor in AIR+FLEX

Step:1
Download FCK Editor from FCKeditor_2.6.4.1.zip

Step:2
Unzip the Folder

Step:3
put this into src folder (means project folder)

Step:4
make a "textArea" having id="myTxtArea"

Step:5
Call a function on creationcomplete

[Bindable]private var sSetFCKEditerValue:String;
/**
* Load the html (fckeditor)
*/
private function load_html() : void
{

html = new HTMLLoader();
var urlReq:URLRequest = new URLRequest("FCKeditor_2.6.4.1/fckeditor/_samples
/adobeair/sample01.html");
html.width = 620;
html.height = 365;
html.load(urlReq);

html.addEventListener(Event.COMPLETE, onHTMLLoadComplete)
myTxtArea.addChild(html);

}

Step:6
On HTML load complete Event(SET the value in FCK Editor)

private function onHTMLLoadComplete(e:Event):void
{

sSetFCKEditerValue = "Sign in to personalize your Google experience."+
"Google has more to offer when you sign in to your Google Account."+
"You can customize pages, view recommendations, and get more relevant search results."+
""+"Sign in on the right or";

try
{
html.window.FCKeditorAPI.__Instances.FCKeditor1.SetHTML(sSetFCKEditerValue);

}
catch(err:Error){}

}

Step:7
Get the updated value from FCK Editor


/**
* get the value of fck editor in the html format
*/
private function getFCKEditerValue():void
{

Alert.show(html.window.FCKeditorAPI.__Instances.FCKeditor1.GetHTML());

}


Thanks
R. Bhatia

No comments:

Post a Comment