You're missing the opening <mx:Application> and <mx:Script> tags aren't
you?  Generally a prolog error is because the top of the MXML file is
invalid.

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of cplus_developer
Sent: Friday, February 24, 2006 5:03 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] problem with DataService

Hello all:
I tried to run the following codes in flex builder 2 :
import mx.rpc.AsyncToken;
import mx.rpc.events.*;
import mx.messaging.events.*;
import mx.utils.ObjectProxy;
private var ds:DataService;
public var noteObj:Object = new Object();
public var getToken:AsyncToken;
public var noteProxy:ObjectProxy;
private function initApp() {
ds = new DataService("notes");
ds.addEventListener(ResultEvent.RESULT, resultHandler);
ds.autoCommit = false;
noteObj.noteId = 1;
noteObj.noteText = "This is a test note.";
getToken = ds.getItem(noteObj, noteObj);
}
private function sendMessage() {
noteProxy.noteText = log.text;
ds.commit();
}
public function resultHandler(event:ResultEvent) {
if (event.call == getToken)
{
noteProxy = ObjectProxy(event.result);
noteProxy.addEventListener(ObjectEvent.CHANGE,
changeHandler);
log.text = noteProxy.noteText;
}
}
public function changeHandler(event:ObjectEvent) {
log.text = noteProxy.noteText;
}
]]>
</mx:Script>
<mx:TextArea id="log" width="100%" height="100%"/>
<mx:Button label="Send" click="sendMessage();"/>
</mx:Application>

it sent me back this error:
1 Error found.

Error /tutorials/tutorial1.mxml:1
Content is not allowed in prolog.

1: import mx.rpc.AsyncToken;
2: import mx.rpc.events.*;

Please help me.
Sincerely yours Mohsena






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to