Bonjour à tous,
Voilà je suis en train de faire les lessons de Flex Builder et j'arrive l'exemple "Note" qui fait appel à Flex Data Service.
J'ai tapé le code, compilé et mis en ligne.
Le principe :
Il s'agit en fait une zone de texte éditable avec un bouton "send".
J'ouvre 2 fois mon navigateur et j'affiche la page dans chaque fenêtre.
Je modifie le texte dans la première fenêtre et click sur "send".
Le text se modifie également dans la 2ème fenêtre.
Tout ça fonctionne très bien mais en local.
Lorsque je fais le test depuis un accès externe, j'ai une erreur du style.
et franchement je ne comprend pas pourquoi...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error null"] at mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::dispatchFaultEvent() at DataListRequestResponder/fault() at mx.rpc::AsyncRequest/fault() at mx.messaging::ChannelSet/faultPendingSends() at mx.messaging::ChannelSet/channelFaultHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.messaging::Channel/connectFailed() at mx.messaging.channels::PollingChannel/connectFailed() at mx.messaging.channels::RTMPChannel/statusHandler()
Quelqu'un à une idée ?
Voici le code en question :
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" width="100%" creationComplete="initApp();"> <mx:Script> <![CDATA[ import mx.data.DataService; import mx.data.events.*; import mx.rpc.AsyncToken; import mx.rpc.events.*; import mx.messaging.events.*; import mx.utils.ObjectProxy; public var noteObj:Object = new Object(); public var getToken:AsyncToken; private var ds:DataService; [Bindable] public var noteProxy:ObjectProxy; public function initApp():void { ds = new DataService("notes"); ds.addEventListener(ResultEvent.RESULT, resultHandler); ds.autoCommit = false; noteObj.noteId = 1; noteObj.noteText ="Type your notes here and share them with other clients!"; getToken = ds.getItem(noteObj, noteObj); } public function resultHandler(event:ResultEvent):void { if (event.token == getToken) noteProxy = ObjectProxy(event.result); } ]]> </mx:Script> <mx:Binding source="log.text" destination="noteProxy.noteText"/> <mx:TextArea id="log" width="100%" height="80%" text="{noteProxy.noteText}"/> <mx:Button label="Send" click="ds.commit();"/> </mx:Application>
Partager