IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Flex Discussion :

Executer plusieurs POST method pour un URLLoader


Sujet :

Flex

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    16
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 16
    Points : 20
    Points
    20
    Par défaut Executer plusieurs POST method pour un URLLoader
    Bonjour,

    J'ai charger une page dans un URLLoader dans cette page il y a une table avec plusieurs page, pour changer de page dans la table il faut faire un POST
    ce que je fait mais je ne sais le faire qu'une seule fois au chargement de la page (enfin de la manière d'on je m'y prend) pouvez vous me dire comment faire pour refaire un POST dans cette page ...

    voice mon code au cas ou :

    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
     
    public function loadHTML():void 
    	        {  
     
    	             myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);  
    	             myHTMLFile.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);  
     
    				 var myUrlRequest:URLRequest = new URLRequest(txtUrl.text)
     
    				 var variables:URLVariables = new URLVariables();
    			     variables.__EVENTTARGET = "ctl00$ContentPlaceHolder1$lnkNext";
    			     variables.__VIEWSTATE = "/wEPBSBiOTdjZDM0MmJjN2Q0NzQ0ODU5YjcyZDM3ODE5NDQ2ZmQRBt89oufrfa5LvMVGJhmKGC7C2A==";
    			     variables.ctl00$ContentPlaceHolder1$ddlPageSize = "25";
     
    				 myUrlRequest.data = variables;
    			     myUrlRequest.method = URLRequestMethod.POST;
     
    				 // myUrlRequest.method = "javascript:__doPostBack('ctl00$ContentPlaceHolder1$lnkNext','')";
     
    	             myHTMLFile.load(myUrlRequest);
     
    	             //myHTMLFile.close();
    	        }  
     
    	        private function onLoadHTML(e:Event):void  
    	        {  
    	             HTMLData = e.target.data;  
    	             initTextField();  
    	        }

    Merci d'avance pour votre aide...

  2. #2
    Membre à l'essai
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    16
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 16
    Points : 20
    Points
    20
    Par défaut j'ai trouver
    J'ai trouver voici toujours la solution :
    il fallait juste mettre le URLLoader en global et rappeler le URLLoader.Load seulement quand le premier appel de URLLoader.Load à répondu...


    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
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
     
    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2007/07/28/downloading-files-in-flex-using-the-filereference-class/ -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            layout="vertical"
            verticalAlign="middle"
            backgroundColor="white" applicationComplete="onAppComplete()">   
     
        <mx:Script>
            <![CDATA[
            	import mx.utils.URLUtil;
            	import mx.rpc.events.FaultEvent;
            	import mx.rpc.events.ResultEvent;
            	import mx.controls.Text;
            	import mx.controls.Label;
                import mx.controls.Alert;
                import mx.collections.ArrayCollection;
                import flash.net.FileReference;   
     
    			[Bindable]
                private var listTable:ArrayCollection = new ArrayCollection();
     
    	        private var txtField:TextField;  
    	        private var HTMLData:String;  
    	        private var myHTMLFile:URLLoader;  
     
     
    	        private var maPage:Sitepage;
     
    	        public function onAppComplete():void
    	        {
    	        	myHTMLFile = new URLLoader();
    	        	myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);  
    	            myHTMLFile.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);
    	        }
     
    	        public function loadHTML():void 
    	        {  
    				 var myUrlRequest:URLRequest = new URLRequest(txtUrl.text)
     
    				 var variables:URLVariables = new URLVariables();
    			     variables.__EVENTTARGET = "ctl00$ContentPlaceHolder1$lnkNext";
    			     variables.__VIEWSTATE = "/wEPBSBiOTdjZDM0MmJjN2Q0NzQ0ODU5YjcyZDM3ODE5NDQ2ZmQRBt89oufrfa5LvMVGJhmKGC7C2A==";
    			     variables.ctl00$ContentPlaceHolder1$ddlPageSize = "10";
     
    				 myUrlRequest.data = variables;
    			     myUrlRequest.method = URLRequestMethod.POST;
     
    				 // myUrlRequest.method = "javascript:__doPostBack('ctl00$ContentPlaceHolder1$lnkNext','')";
     
    	             myHTMLFile.load(myUrlRequest);
    	             //myHTMLFile.load(myUrlRequest);
    	             //myHTMLFile.close();
    	        }  
     
    	        private function onLoadHTML(e:Event):void  
    	        {  
    	             HTMLData = e.target.data;  
    	             initTextField();  
    	        }  
     
    	        private function initTextField():void  
    	        {  
    	         	 Alert.show("Table List Loaded");
     
    	   			 txt.text = HTMLData;
    				 //myHTMLFile.removeEventListener(Event.COMPLETE, onLoadHTML);  
    	             //myHTMLFile.removeEventListener(IOErrorEvent.IO_ERROR, ioError);  
    	        }  
     
    	        private function ioError(e:IOErrorEvent):void  
    	        {  
    	         	 Alert.show(e.text);
    	             trace ("Error: File " + e.text + " could not be loaded");  
    	        }
     
     
            ]]>
        </mx:Script>   
     
        <mx:HBox id="myHBox">
        	<mx:Label text="Url : "/>
            <mx:TextInput id="txtUrl" width="350">
                <mx:text></mx:text>
            </mx:TextInput>
            <mx:Button click="loadHTML()" label="Load Tables" ></mx:Button>
     
            <mx:ComboBox id="cmbBox" dataProvider="{listTable}"></mx:ComboBox>
        </mx:HBox>
        <mx:VBox id="myHBoxBottom" height="100%" width="100%">
       		<mx:TextArea width="100%" height="50%" id="txt" />
       		<mx:TextArea width="100%" height="50%" id="txtRow" />
        </mx:VBox>
    </mx:Application>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 05/07/2019, 12h11
  2. Réponses: 2
    Dernier message: 19/06/2007, 15h21
  3. [Projet Colossal] Recrutement pour plusieurs postes
    Par Albior dans le forum Projets
    Réponses: 27
    Dernier message: 23/09/2006, 14h21
  4. [VBA-E]Methode pour trouver une valeur qui apparait plusieur fois
    Par Elstak dans le forum Macros et VBA Excel
    Réponses: 9
    Dernier message: 23/05/2006, 13h11
  5. Réponses: 7
    Dernier message: 29/04/2006, 15h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo