19
Jun
07

flash DATASET

Utiliser un DataSet avec FLASH 

 

Actionscript:
  1.  
  2.  
  3. //This code can be directly copied and pasted onto frame 1 and should work
  4. //practically as is. Obviously this is not recommended practice but it should
  5. //give you a head start
  6.  
  7. import mx.remoting.*;
  8. import mx.rpc.*;
  9. import mx.utils.Delegate;
  10. import mx.remoting.debug.NetDebug;
  11.  
  12. //Change the gateway URL as needed
  13. var gatewayUrl:String = “<a href=”http://127.0.0.1/speechie/amfphp/gateway.php">http://127.0.0.1/speechie/amfphp/gateway.php</a>";
  14.  
  15. NetDebug.initialize();
  16. service = new Service(gatewayUrl, null, “SpeechieClass”);
  17.  
  18.  
  19. //renvoit la liste des membres>id
  20. function getMembresSup(id)
  21. {
  22.  var pc:PendingCall = service.getMembresSup(id);
  23.  pc.responder = new RelayResponder(this, “handleGetMembresSup”, null);
  24. }
  25.  
  26. //get membres ici: renvoit la liste des membres
  27. function getMembres()
  28. {
  29.  var pc:PendingCall = service.getMembres();
  30.  pc.responder = new RelayResponder(this, “handleGetMembres”, null);
  31. }
  32.  
  33.  
  34. function handleGetMembresSup(re:ResultEvent)
  35. {
  36.  //Implement custom callback code
  37.  trace(“handleGetMembresSup”);
  38. }
  39.  
  40. function handleGetMembres(re:ResultEvent)
  41. {
  42.  //Implement custom callback code
  43.  trace(“handleGetMembres”);
  44.  people_lb.dataProvider=re.result;
  45. }
  46. // appeler
  47. //getMembres();
  48. trace(“ici”);
  49. var recData = [{id:0, firstName:“Frank”, lastName:“Jones”, age:27, usCitizen:true},
  50.               {id:1, firstName:“Susan”, lastName:“Meth”, age:55, usCitizen:true},
  51.               {id:2, firstName:“Pablo”, lastName:“Picasso”, age:108, usCitizen:false}];
  52.  
  53. //Assigns recData to the items property of the "myDataSet" DataSet component instance
  54. myDataSet.items = recData;
  55.  
  56. //Adds schema types for the expected fields
  57. var i:mx.data.types.Str;
  58. var j:mx.data.types.Num;
  59.  
  60. //Makes the first item the current item
  61. myDataSet.first();
  62.  
  63. //Traces through the properties
  64. while ( myDataSet.hasNext() ) {
  65.   //access the data through the Dataset properties
  66.   trace(myDataSet.firstName + ” “ + myDataSet.lastName);
  67.   myDataSet.next();
  68. }


0 Responses to “Linux : executer un script au demarrage”


  1. No Comments

Leave a Reply