Flash CS3

Free tutorials and scripts for all

Sometimes members don't get their activation email.
This happens because it gets deleted by accident, your spam folder gets it ... lots of reasons.
To Resend the account activation code you need to do two things:
1. Go here: Resend your activation email
2. Enter the email address you used when you signed up and click "Email activation codes"
3. When the email arrives in your inbox, be sure to click the link to activate your account.

Flash CS3 GuestBook

This is a discussion on Flash CS3 GuestBook within the Utilità di FlepStudio forums, part of the Articoli e tutorials category; Grazie flep Credo di aver quasi risolto la questione... il problema è che adesso questo messaggio nell'esecuzione del flash Error: ...


Go Back   Forum Flash CS3 > Flash CS3 e Actionscript 3.0 > Articoli e tutorials > Utilità di FlepStudio

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 30-11-07, 08:56
Member
 
Join Date: Sep 2007
Posts: 71
Rep Power: 1
Vlizzard is on a distinguished road
Re: Flash CS3 GuestBook

Grazie flep
Credo di aver quasi risolto la questione... il problema è che adesso questo messaggio nell'esecuzione del flash

Quote:

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at Main/::inviaDati()
at Main/::checkTheForm()
at MethodInfo-240()
Credo che i problemi sono dovute al fatto che non so come assegnare il tipo di valore alla variabile ovvero:

Code:
 
private function inviaDati():void
{
var ContrEmail:String=String(form_mc.email_txt.text);
var variables:URLVariables=new URLVariables(ContrEmail);
var richiesta:URLRequest=new URLRequest();
richiesta.url='http://www.nomedelsito/control_email.php';
richiesta.method=URLRequestMethod.POST;
richiesta.data=variables;
var loader:URLLoader=new URLLoader();
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
addListeners(loader);
try 
{
loader.load(richiesta);
} 
catch (error:Error) 
{
trace('Unable to load richiestaed document.');
}
}
Prima avevo dichiarato ContrEmail come TextField, ma andava in errore nella compilazione, allora ho cambiato a String....
come devo dichiarare?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #12 (permalink)  
Old 30-11-07, 09:19
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,321
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3 GuestBook

Fammi vedere come fai l' echo dal PHP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 30-11-07, 09:36
Member
 
Join Date: Sep 2007
Posts: 71
Rep Power: 1
Vlizzard is on a distinguished road
Re: Flash CS3 GuestBook

dopo il confronto


PHP Code:
if ($uid!="0") {
 
$answer "1";
    echo 
$answer;
}
else
{
 
$answer "0";
    echo 
$answer;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 30-11-07, 09:40
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,321
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3 GuestBook

Fai così:
PHP Code:
if ($uid!="0") {
$answer "1";
    echo 
'answer='.$answer;
}
else
{
$answer "0";
    echo 
'answer='.$answer;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 30-11-07, 11:27
Member
 
Join Date: Sep 2007
Posts: 71
Rep Power: 1
Vlizzard is on a distinguished road
Re: Flash CS3 GuestBook

niente....

però ho dimenticato che all'inizio ho dichiarato

Code:
 
  var contr:String;
può essere questo?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 30-11-07, 11:46
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,321
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3 GuestBook

Scrivi tutta la classe che usi per favore perchè così a pezzi non ti seguo :(
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 30-11-07, 17:03
Member
 
Join Date: Sep 2007
Posts: 71
Rep Power: 1
Vlizzard is on a distinguished road
Re: Flash CS3 GuestBook

ovvio ...chiedo scusa ti invio tutta il Main.as del guestbook modificato...

Code:
 
/*
 *************************************
  Guest Book                               
  http://www.FlepStudio.org     
  © Author: Filippo Lughi          
  version 1.0                                
 *************************************
 */
package
{
 import flash.display.MovieClip;
 import flash.text.TextField;
 import flash.geom.Rectangle;
 import flash.utils.Timer;
 import fl.controls.SliderDirection;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import fl.events.SliderEvent;
 import flash.events.TimerEvent;
 import flash.net.URLLoader;
 import flash.net.URLVariables;
 import flash.net.URLRequest;
 import flash.net.URLRequestMethod;
 import flash.net.URLLoaderDataFormat;
 import flash.events. IEventDispatcher;
 
 public class Main extends MovieClip
 {
  private var file_xml:LoadingXML;
  
  private var mess_container_mc:MovieClip;
  private var mask_mc:MovieClip;
  
  private var timer:Timer;
  
  private var formStartX:Number;
  private var formStartY:Number;
  
  var contr:String;
  
  public function Main()
  {
   init();
   createContainer();
   loadXML();
  }
  
  private function init():void
  {
   stage.frameRate=31;
   
   info_mc.x=stage.stageWidth/2;
   info_mc.y=stage.stageHeight/2;
   
   bg_mc.x=0;
   bg_mc.y=0;
   bg_mc.width=stage.stageWidth;
   bg_mc.height=stage.stageHeight;
   
   form_mc.alpha=0;
   box_mc.alpha=0;
   
   slide_mc.visible=false;
  }
  
  private function createContainer():void
  {
   mess_container_mc=new MovieClip();
   mess_container_mc.alpha=0;
   addChild(mess_container_mc);
  }
  
  private function loadXML():void
  {
   file_xml=new LoadingXML(this);
  }
  
  public function displayGuestBook():void
  {
   removeLoadingInfo();
   createClipsForEachMessage();
  }
  
  private function removeLoadingInfo():void
  {
   info_mc.stop();
   removeChild(info_mc);
  }
  
  private function createClipsForEachMessage():void
  {
   for(var i:int=0;i0)
     Store.clips_array[i].y=Store.clips_array[i-1].y+Store.clips_array[i-1].height+10;
   }
   fadeIn(mess_container_mc);
  }
  
  private function createMask():void
  {
   mask_mc=new MovieClip();
   addChild(mask_mc);
   mask_mc.graphics.beginFill(0xFF6600,1);
   mask_mc.graphics.drawRect(0,0,Store.clips_array[0].width+10,form_mc.height+box_mc.height+15);
   mask_mc.x=Store.clips_array[0].x-5;
   mask_mc.y=Store.clips_array[0].y-5;
   
   mess_container_mc.mask=mask_mc;
  }
  
  private function initForm():void
  {
   form_mc.scope_mc.mouseChildren=false;
   
   form_mc.x=Store.clips_array[0].x+Store.clips_array[0].width+20+form_mc.width/2;
   form_mc.y=Store.clips_array[0].y+form_mc.height/2;
   formStartX=form_mc.x;
   formStartY=form_mc.y-20;
   fadeIn(form_mc);
   
   swapChildren(mess_container_mc,form_mc);
   
   form_mc.message_txt.background=true;
   form_mc.message_txt.backgroundColor=0xFFFFFF;
   form_mc.scope_mc.buttonMode=true;
   form_mc.scope_mc.addEventListener(MouseEvent.MOUSE_DOWN,setDown);
   form_mc.scope_mc.addEventListener(MouseEvent.MOUSE_UP,setUp);
  }
  
  private function setDown(evt:MouseEvent):void
  {
   form_mc.removeEventListener(Event.ENTER_FRAME,moveFormBack);
   var rect:Rectangle=new Rectangle(evt.currentTarget.parent.width/2,evt.currentTarget.parent.height/2,
                 stage.stageWidth-evt.currentTarget.parent.width,stage.stageHeight-evt.currentTarget.parent.height);
   evt.currentTarget.parent.startDrag(false,rect);
  }
  
  private function setUp(evt:MouseEvent):void
  {
   evt.currentTarget.parent.stopDrag();
   var xx:Number=box_mc.x-form_mc.x;
   var yy:Number=box_mc.y-form_mc.y;
   var distance:Number=Math.sqrt(xx*xx+yy*yy);
   if(distance<100)
    suckTheForm();
   else
    notCentered();
  }
  
  private function initBox():void
  {
   box_mc.x=form_mc.x;
   box_mc.y=form_mc.y+form_mc.height+10;
   fadeIn(box_mc);
  }
  
  private function initSlide():void
  {
   slide_mc.width=mask_mc.height;
   slide_mc.direction=SliderDirection.VERTICAL;
   slide_mc.move(Store.clips_array[0].x-20,Store.clips_array[0].y+mask_mc.height);
   slide_mc.minimum=mess_container_mc.x;
   slide_mc.maximum=mess_container_mc.height-mask_mc.height;
   slide_mc.visible=true;
   slide_mc.value=slide_mc.minimum;
   slide_mc.rotation*=-1;
   
   slide_mc.addEventListener(SliderEvent.THUMB_PRESS,pressing);
   slide_mc.addEventListener(SliderEvent.THUMB_RELEASE,stopTheLogic);
   slide_mc.addEventListener(SliderEvent.CHANGE,pressing);
  }
  
  private function pressing(evt:SliderEvent):void
  {
   evt.target.addEventListener(Event.ENTER_FRAME,go);
  }
  
  private function go(evt:Event):void
  {
   mess_container_mc.y=-evt.target.value;
  }
  
  private function stopTheLogic(evt:SliderEvent):void
  {
   evt.target.removeEventListener(Event.ENTER_FRAME,go);
  }
  
  private function fadeIn(m:MovieClip):void
  {
   m.addEventListener(Event.ENTER_FRAME,go);
   function go(evt:Event):void
   {
    var da:Number=1-evt.currentTarget.alpha;
    var aa:Number=da*.2;
    evt.currentTarget.alpha+=aa;
    
    if(Math.abs(da)<=.1)
    {
     evt.currentTarget.alpha=1;
     evt.currentTarget.removeEventListener(Event.ENTER_FRAME,go);
    }
   }
  }
  
  private function suckTheForm():void
  {
   var arr:int=0;
   var arr2:Number=box_mc.x;
   var arr3:Number=box_mc.y;
   var arr4:int=0;
   form_mc.addEventListener(Event.ENTER_FRAME,suck);
   function suck(evt:Event):void
   {
    var dx:Number=arr-evt.currentTarget.scaleX;
    var ax:Number=dx*.2;
    evt.currentTarget.scaleX+=ax;
    evt.currentTarget.scaleY+=ax;
    
    var dX:Number=arr2-evt.currentTarget.x;
    var aX:Number=dX*.2;
    evt.currentTarget.x+=aX;
    
    var dY:Number=arr3-evt.currentTarget.y;
    var aY:Number=dY*.2;
    evt.currentTarget.y+=aY;
    
    var da:Number=arr4-evt.currentTarget.alpha;
    var aa:Number=da*.2;
    evt.currentTarget.alpha+=aa;
    
    if(Math.abs(dx)<=.1)
    {
     evt.currentTarget.scaleX=arr;
     evt.currentTarget.scaleY=arr;
     evt.currentTarget.removeEventListener(Event.ENTER_FRAME,suck);
     checkTheForm();
    }
   }
  }
  
  private function checkTheForm():void
  {
    if(EmailChecker.checkEMail(form_mc.email_txt.text))
   {
    switch(form_mc.name_txt.text)
    {
     case '':
     notValid('name');
     break;
     
     default:
     switch(form_mc.message_txt.text)
     {
      case '':
      notValid('message');
      break;
      
      default:
      inviaDati();
      if(contr!='1')
        {
           sendMessage();
        break;
        } 
      else
        {
           notValid('mail');
        }
     }
     break;
    }
   }
   else
    notValid('mail');
  }
  
  private function inviaDati():void
  {
   var ContrEmail:String=String(form_mc.email_txt.text);
   var variables:URLVariables=new URLVariables(ContrEmail);
   var richiesta:URLRequest=new URLRequest();
   richiesta.url='http://www.nomedelsito.com/control_email.php';
   richiesta.method=URLRequestMethod.POST;
   richiesta.data=variables;
   var loader:URLLoader=new URLLoader();
   loader.dataFormat=URLLoaderDataFormat.VARIABLES;
   addListeners(loader);
   try 
   {
    loader.load(richiesta);
   } 
   catch (error:Error) 
   {
    trace('Unable to load richiestaed document.');
   }
  }
  
  private function addListeners(d:IEventDispatcher):void
  {
   d.addEventListener(Event.COMPLETE,completato);
  }
  
  private function completato(e:Event):void
  {
   var loader:URLLoader=URLLoader(e.target);  
   var vars:URLVariables=new URLVariables(loader.data);
   contr=(vars.answer).toString();
   
  }
  
  private function notValid(s:String):void
  {
   var arr:int=1;
   var arr2:Number=formStartX;
   var arr3:Number=formStartY;
   var arr4:int=1;
   form_mc.addEventListener(Event.ENTER_FRAME,suck);
   function suck(evt:Event):void
   {
    var dx:Number=arr-evt.currentTarget.scaleX;
    var ax:Number=dx*.2;
    evt.currentTarget.scaleX+=ax;
    evt.currentTarget.scaleY+=ax;
    
    var dX:Number=arr2-evt.currentTarget.x;
    var aX:Number=dX*.2;
    evt.currentTarget.x+=aX;
    
    var dY:Number=arr3-evt.currentTarget.y;
    var aY:Number=dY*.2;
    evt.currentTarget.y+=aY;
    
    var da:Number=arr4-evt.currentTarget.alpha;
    var aa:Number=da*.2;
    evt.currentTarget.alpha+=aa;
    
    if(Math.abs(dx)<=.1)
    {
     evt.currentTarget.scaleX=arr;
     evt.currentTarget.scaleY=arr;
     evt.currentTarget.removeEventListener(Event.ENTER_FRAME,suck);
     
     switch(s)
     {
      case 'mail':
      evt.currentTarget.scope_mc.output_txt.text=' EMAIL NON VALIDO ';
      resetOutput();
      break;
      
      case 'name':
      evt.currentTarget.scope_mc.output_txt.text=' NOME NON VALIDO ';
      resetOutput();
      break;
      
      case 'message':
      evt.currentTarget.scope_mc.output_txt.text=' MESSAGGIO NON VALIDO ';
      resetOutput();
      break;
     }
    }
   }
  }
  
  private function notCentered():void
  {
   form_mc.addEventListener(Event.ENTER_FRAME,moveFormBack);
  }
  
  private function moveFormBack(evt:Event):void
  {
   var arr2:Number=formStartX;
   var arr3:Number=formStartY+10;
   var dX:Number=arr2-evt.currentTarget.x;
   var aX:Number=dX*.3;
   evt.currentTarget.x+=aX;
   
   var dY:Number=arr3-evt.currentTarget.y;
   var aY:Number=dY*.3;
   evt.currentTarget.y+=aY;
   
   if(Math.abs(dX)<=.3)
   {
    evt.currentTarget.x=arr2;
    evt.currentTarget.y=arr3;
    evt.currentTarget.removeEventListener(Event.ENTER_FRAME,moveFormBack);
   }
  }
  
  private function resetOutput():void
  {
   timer=new Timer(1500,1);
   timer.addEventListener(TimerEvent.TIMER,reset);
   timer.start();
   function reset(evt:TimerEvent):void
   {
    form_mc.scope_mc.output_txt.text=' ';
   }
  }
  
  private function sendMessage():void
  {
   var send_the_message:SendTheMessage=new SendTheMessage(form_mc.name_txt.text,form_mc.email_txt.text,form_mc.message_txt.text,this);
  }
 }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 30-11-07, 17:11
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,321
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3 GuestBook

Va in conflitto perchè chiami addListeners() passando lo stesso loader e aggiungendo gli stessi listeners.

Devi utilizzare un altro file AS che fa solo quel controllo.

Una curiosità... non ti conviene inserire il guestbook in una pagina in cui controlli le sessioni ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 30-11-07, 17:17
Member
 
Join Date: Sep 2007
Posts: 71
Rep Power: 1
Vlizzard is on a distinguished road
Re: Flash CS3 GuestBook

No xchè vorrei renderlo visibile a tutti ma solo i reg possono scrivere così che se un utente registrato inserisce numeri di telefono altrui o insulti lo posso bannare dal sito
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 30-11-07, 17:22
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,321
Blog Entries: 1
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3 GuestBook

Allora al click del bottone invia, prima di fare quello che fa adesso, commenta il codice e scrivi un nuovo file AS che controlla solo la mail.
Istanzi la nuova classe.
A quel punto se la mail è esistente, dalla nuova classe chimai una nuova funzione su Main.as che eseguirà il codice che hai commentato e spostato in questa nuova funzione.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Flash CS3 GuestBook Flep FlepStudio utilities 30 01-08-08 06:01
guestbook premiere Actionscript 3.0 base 5 30-01-08 06:24
Flash Guestbook - knowledge requirements hard_overclocker Flash CS3 eng 1 14-11-07 12:03
load guestbook Flasher111 HELP free utilities 7 26-09-07 18:40
GuestBook in Flash CS3 - PHP - mySQL e XML Vlizzard AIUTO utilità free 1 25-09-07 17:48


All times are GMT. The time now is 18:50.


Powered by vBulletin versione 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap

FlepStudio
by Filippo Lughi
P.IVA 03605860406