home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 73 / IOPROG_73.ISO / tips / Flash e menu contestuali / Login.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2003-07-31  |  2.2 KB  |  112 lines

  1. function Reset()
  2. {
  3.    totLogins = 0;
  4.    TotHeight = 0;
  5.    StageHeight = 300;
  6. }
  7. function SetDefaultFinalAlpha(alpha)
  8. {
  9.    if(alpha == _root.LastAlpha)
  10.    {
  11.       return undefined;
  12.    }
  13.    _root.LastAlpha = alpha;
  14.    i = 1;
  15.    while(i <= totLogins)
  16.    {
  17.       obj = eval("_root.Login_" + i);
  18.       obj.DefaultFinalAlpha = alpha;
  19.       if(obj._currentframe == 1)
  20.       {
  21.          obj.FinalAlpha = alpha;
  22.       }
  23.       i++;
  24.    }
  25. }
  26. function CloseLogins()
  27. {
  28.    i = 1;
  29.    while(i <= totLogins)
  30.    {
  31.       obj = eval("_root.Login_" + i);
  32.       obj.gotoAndStop(1);
  33.       i++;
  34.    }
  35. }
  36. function CreateLogin(UserName, id, Foto)
  37. {
  38.    totLogins++;
  39.    newName = "Login_" + totLogins;
  40.    _root.attachMovie("ClpLogin" + id,newName,totLogins);
  41.    obj = eval("_root." + newName);
  42.    obj.id = id;
  43.    obj._x = 9;
  44.    obj.DefaultFinalAlpha = 40;
  45.    obj.istNome.txtNome = UserName;
  46.    if(Foto != "")
  47.    {
  48.       obj.istFoto.istFoto.loadMovie(Foto);
  49.       obj.istFoto.istSpecchio._visible = false;
  50.    }
  51.    obj.MyFoto = Foto;
  52.    switch(id)
  53.    {
  54.       case 1:
  55.          obj.myHeight = 90;
  56.          break;
  57.       case 2:
  58.          obj.myHeight = 70;
  59.          break;
  60.       case 3:
  61.          obj.myHeight = 70;
  62.    }
  63.    TotHeight += obj.myHeight;
  64. }
  65. function PositionateLogins()
  66. {
  67.    startY = (StageHeight - TotHeight) / 2;
  68.    pos = 0;
  69.    i = 1;
  70.    while(i <= totLogins)
  71.    {
  72.       obj = eval("_root.Login_" + i);
  73.       obj._y = startY + pos;
  74.       pos += obj.myHeight;
  75.       i++;
  76.    }
  77.    setScroll(TotHeight);
  78. }
  79. function doLogin(Username, Password, Foto)
  80. {
  81.    setScroll(StageHeight);
  82.    i = 1;
  83.    while(i <= totLogins)
  84.    {
  85.       obj = eval("_root.Login_" + i);
  86.       obj.removeMovieClip();
  87.       i++;
  88.    }
  89.    Reset();
  90.    CreateLogin(Username,3,Foto);
  91.    PositionateLogins();
  92. }
  93. function setScroll(myHeight)
  94. {
  95.    if(myHeight < StageHeight)
  96.    {
  97.       h = StageHeight;
  98.    }
  99.    else
  100.    {
  101.       h = myHeight + 20;
  102.    }
  103.    fscommand("SETSCROLL",h);
  104. }
  105. Reset();
  106. CreateLogin("Sergio",2,"Sergio.jpg");
  107. CreateLogin("Simone",2,"Simone.jpg");
  108. CreateLogin("Massimo",2,"Massimo.jpg");
  109. CreateLogin("Altro utente",1,"");
  110. PositionateLogins();
  111. stop();
  112.