Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 20-07-2004, 15:18   #1 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
pfadproblem - funktion als referenz an methode übergeben

Hi
diese zeile
ActionScript:
  1. _root[this.method]("es klappt")
würd ich gerne ändern...

hier wird einfach nur die root funktion aufgerufen - deren name in lv.method gesetzt wurde....
ich will aber jede beliebige funktion - und nicht nur welche auf root...
also müsste das irgendwie so lauten.
ActionScript:
  1. [this.method]("es klappt")
aber ich weissnicht wie ich übergeben kann....wenn ich "_root.out" anstatt "out" zuweise - geht halt nix...
Ich hoffe jemand versteht was ich meine.---ist eigentlich leicht - aber dumm in worte zu fassen....
Gruss nky

ActionScript:
  1. //CONNECT METHOD
  2. DB.prototype.connects=function(pScript,pRequestMethod)
  3. {   
  4.    
  5.     var     lv             =   new LoadVars()
  6.         lv.owner        =   this;
  7.         lv.method      =  "out";
  8.         lv[this.varname]  = this.values;    
  9.         lv.onLoad     = function(ok)
  10.         {         
  11.             if(ok) 
  12.             {
  13.             _root[this.method]("es klappt")
  14.             //_root.test.text=this.response;
  15.             }
  16.         }
  17.        
  18.         //REQUEST METHOD CAN BE OVERWRITTEN WITH THIS METHOD
  19.         if(pRequestMethod==undefined)
  20.             lv.sendAndLoad(pScript,lv,this.requestMethod)
  21.         else
  22.             lv.sendAndLoad(pScript,lv,pRequestMethod)
  23. }
nky ist offline   Mit Zitat antworten
Alt 20-07-2004, 15:22   #2 (permalink)
Neuer User
 
Registriert seit: Jun 2001
Ort: Stuttgart
Beiträge: 6.415
evaluier per eval.
da kannste dann ne punktsyntax übergeben oder auch nich
ActionScript:
  1. f=function(){
  2. trace("hi")
  3. }
  4. x="f"
  5. eval(x)()


deluxe
Deluxe ist offline   Mit Zitat antworten
Alt 20-07-2004, 15:29   #3 (permalink)
querdenker
 
Benutzerbild von kelor
 
Registriert seit: Jun 2001
Ort: formel1-stadt hockenheim
Beiträge: 4.731
ich weis was du meinst marcel...

der punkt ist ja aber der, dass der 'arrayzugriffsoperator' eine auswertung des inhalts deer eckigen klammern ZU der zeitleiste, die voran gestellt ist, auswertet...

du hast doch bestimmt irgendeine zeitleiste...oder?
über die du zugreifen kannst...?
irgendwas mußt du da flash schon anbieten...

wie ist denn dein aufbau sonst...

kannst du nicht der klasse noch ne eigenschaft anhängen, oder ne methode, die dir timelines added in ein array?

dann könntest du zumindest so dran...

gib mal bescheid...


greetz

kelor
kelor ist offline   Mit Zitat antworten
Alt 20-07-2004, 15:30   #4 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
Danke DU stolzer Grieche
mit eval arbeite ich sonst nie - aber wenns keine andere Möglichkeit gibt ..
was solls ..


Vielen Dank ...Du warst so schnell das ich nichtmal in meinem Workflow gestört wurde

Gruss nky
...der sich gerade denkt was für auswirkungen es haben würde st*lzer Deuts*her in der Sig stehen zu haben....ROFL
nky ist offline   Mit Zitat antworten
Alt 20-07-2004, 15:34   #5 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
ich poste mal die ganze klasse - ist zwar noch nicht fertig aber was solls..
Hier ist das Monster...aber noch nicht fertig...

ActionScript:
  1. /*NOT ANY COPYRIGHT :)
  2. ****************************************
  3. *
  4. * DB CLASS VER 0.1
  5. * Lets you  handle simple DB connections easier.
  6. *
  7. *************************************** 
  8. *Suggestions and criticism (mail@nkylab  DOT  de)
  9. * [url]http://www.nkylab.de[/url]
  10. ****************************************
  11. */
  12.  
  13. //CONSTRUCTOR
  14. function DB()
  15. {
  16.     this.values   =    ["test1","test2"];    //VALUE ARRAY 
  17.     this.varname        =    "MyFlashArray";        //DEFAULT NAME OF SUBMITTED VARIABLE
  18.     this.requestMethod  = "POST";      //DEFAULT REQUEST METHOD 
  19. }
  20. //***********************************************************************************
  21.  
  22. //CONNECT METHOD
  23. DB.prototype.connects=function(pScript,pRequestMethod)
  24. {   
  25.    
  26.     var     lv             =   new LoadVars()
  27.         lv.owner        =   this;
  28.         lv.method      =  "out";
  29.         lv[this.varname]  = this.values;    
  30.         lv.onLoad     = function(ok)
  31.         {         
  32.             if(ok) 
  33.             {
  34.             _root[this.method]("es klappt")
  35.             //_root.test.text=this.response;
  36.             }
  37.         }
  38.        
  39.         //REQUEST METHOD CAN BE OVERWRITTEN WITH THIS METHOD
  40.         if(pRequestMethod==undefined)
  41.             lv.sendAndLoad(pScript,lv,this.requestMethod)
  42.         else
  43.             lv.sendAndLoad(pScript,lv,pRequestMethod)
  44. }
  45. //***********************************************************************************
  46.  
  47. //TEST METHOD NOT READY !!!
  48. DB.prototype.test=function()
  49. {
  50.     return "OK";
  51. }
  52.  
  53. //GETTERS/SETTERS STARTS HERE
  54. //***********************************************************************************
  55.  
  56. DB.prototype.setValues=function(pArray)
  57. {
  58.     this.values=pArray;
  59. }
  60.  
  61. DB.prototype.getValues=function()
  62. {
  63.     return this.values;
  64. }
  65. //***********************************************************************************
  66.  
  67. DB.prototype.setVarname=function(pVarname)
  68. {
  69.     this.varname=pVarname;
  70. }
  71.  
  72. DB.prototype.getVarname=function()
  73. {
  74.     return this.varname;
  75. }
  76. //***********************************************************************************
  77.  
  78. DB.prototype.setRequestMethod=function(pRequestMethod)
  79. {
  80.     this.requestMethod=pRequestMethod;
  81. }
  82.  
  83. DB.prototype.getRequestMethod=function()
  84. {
  85.     return this.requestMethod;
  86. }
  87. //***********************************************************************************
  88.  
  89.  
  90. /*
  91. * USAGE:
  92. */
  93.  
  94.  
  95.  
  96.  
  97.  
  98. out=function(pBla)
  99. {
  100.     _root.test.text=pBla;
  101. }

Die Timeline wäre in diesem Fall root erstes frame (wie immer eigentlich )
ActionScript:
  1. stop();
  2. #include "db.as"
  3.  
  4. //AT FIRST SOME TESTVARS
  5. var db= new DB();                     //At First we create an Instance of the Object
  6.     db.setRequestMethod("POST");            //Now we set the Default Request Method (can be overwritten later)
  7. var name_arr = ["ryu","ken","dhalsim"];  //Create a testlist..
  8.  
  9.  
  10. //SENDING EXAMPLES
  11. //#1
  12. //First example (simple list)
  13. db.setVarname("streetfighters");            //set the name of the var - which is sent to php
  14. db.setValues(name_arr);      //define our testlist to send
  15. db.connects("./db.php","");     //make a connect to php - if no RequestMethod is set - DB uses POST (see at the beginning)
  16.  
  17. /*
  18. //#2
  19. //Second Exmple (the same like #1 - but we overwrite the request method)
  20. db.setVarname("streetfighters");            //set the name of the var - which is sent to php
  21. db.setValues(name_arr);      //define our testlist to send
  22. db.connects("./db.php","GET");        //make a connect to php - now with a GET REQUEST
  23. */
  24.  
  25. //LOADING EXAMPLES
  26.  



wär cool wenn du was wüsstest
Gruss nky
nky ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 00:41 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele