Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Flash CS3, interazione con PHP MySql

This is a discussion on Flash CS3, interazione con PHP MySql within the Flash CS3 | PHP | mySQL forums, part of the Flash CS3 generale category; Salve amici... ho un piccolo grande problema... (spero che mi possiate aiutare) vorrei far ricevere a flash (o meglio alla ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 e Actionscript 3.0 > Flash CS3 generale > Flash CS3 | PHP | mySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 13-11-07, 11:24
Junior Member
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0
Mattia86 is on a distinguished road
Question Flash CS3, interazione con PHP MySql

Salve amici...

ho un piccolo grande problema...
(spero che mi possiate aiutare)

vorrei far ricevere a flash (o meglio alla Document Class che ho creato) una query con dei valori... sia interi che stringhe che date...

come posso fare? ho un pò girato sull'web ma non son riuscito a trovare una spiegazione adeguata... qui sul forum ho provato con gli script già fatti dal mitico Flep, ma non son riuscito a capirci molto...

è possibile per caso lanciare direttamente una query da Flash?

spero che abbiate capito il problema..

un saluto a tutti...
Mattia
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 13-11-07, 11:51
Senior Member
 
Join Date: Jan 1970
Posts: 130
Rep Power: 39
nootropic.kint is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

ciao mattia

è possibile chiamare direttamente dei metodi di php da flash
usando il webservices amfphp.
in as3.0 le librerie sono già installate devi solo dichiare il metodo di encoding
in php devi installare uno script - molto semplice la'installazione
ti crei la tua classe in php con i suoi metodi e li chiami direttamente da flash

in giro nei forum ci sono gran lodi a questo amfphp che , dicono, gira molto bene..
ma io non sono ci sono riuscito..
ho anche mollato subito perchè secondo me i webservices non sono più l'avanguardia ma questo è un altro discorso molto opinabile..

se vuoi seguire uno standard (csa che ti consiglio molto) puoi usare dell'xml. io ho fatto così
crei degli script in php formattino gli output dell'sql in un xml specifico. poi crei un .as che parsa questi xml e si mangia le variabili..
in as non è troppo difficile se hai un minimo di dimestichezza con la programmazione..
per chamare uno script php e e memorizzare il risultato in as guardati queste librerie:

Code:
// netlib
import flash.net.URLLoader;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLLoaderDataFormat ;
import flash.xml.XMLDocument;
import flash.xml.XMLNode;
import flash.net.navigateToURL;
ti incollo qualche metodo che ho scritto

ovviamente si basa tutto su codice di flep : DD
quindi ringrazia flep mi raccomando : DD

Code:
       var variablesToSend:Object;
       ...

        private function sendToPhp():void {
		import flash.net.URLVariables;
		import flash.net.URLLoader;
		
		var v : URLVariables = variablesToSend.formatData();
	
		var l,s : URLLoader; 
		l = new RemotingPhp ();
		
		s = l.enstablishNet( "script.php", v );
		s.addEventListener(Event.COMPLETE,completeHandler);
	}
***
qui devi crearti l'oggetto generico variablesToSend
e metterci dentro i dati da mandare a php.. come se fosse script.php?variablesToSend
***

e
Code:
	public function enstablishNet(argv1:String , argv2:Object):URLLoader {

		/**
     	         * Create a connceton via HTML protocol for interfacing with server-side part of
		 * application (in this case php POST)
     	         *
     	         * @param     argv1 server-side script or page to ask for
		 * @param	  argv2 data object to attach at the request
     	         * @return    URLLoader object (extends EventDispatcher) 
		 *			  that dispatch notification events about reciving data from server 
		 *			  see materials about event-driver application for more information.
		 * @since 	  ActionScript 3.0 , Flash Player 9
     	         * @see       flash.net.URLLoader , flash.net.URLRequest , flash.events.EventDispatcher
		 *			  security chapter  in the Programming ActionScript 3.0 book
     	         */
		
		var req:URLRequest=new URLRequest();
        req.url = _host + argv1 ;
        req.method=URLRequestMethod.POST;
        req.data = argv2 ;
        
		//dico a loader di formattare la stringa invio dei dati ( per intenderci come fosse bambi.php?numero=...)
		var loader:URLLoader=new URLLoader();
        loader.dataFormat=URLLoaderDataFormat.TEXT;
            
        addNetListeners(loader);
        try {
            loader.load(req);
        }
        catch (error:Error) {
			// here must throws an exception !!
            trace('Unable to load richiestaed document.');
        }
		
		return loader;
	}
poi avrai un metodo completeHandler in cui gestisci l'oggetto URLLoader come vuoi parsando l'xml che avrà dentro i risultati di sql

spero di esserti stato chiaro
se riguardi gli esempi di fle c'è tutto!!
ciao
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 13-11-07, 12:19
Junior Member
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0
Mattia86 is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

Insomma...
ho letto tutto quello che hai scritto...
ma non mi è motlo chiaro, adesso leggerò qualche guida su XML, xchè non ci ho mai messo le mani sopra...
pensavo che c'era qualkosa di più semplice x farlo... tipo una semplice funzione...

grazie x la pronta risposta e a Flep x tutto il materiale che ci mette a disposizione..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 13-11-07, 12:25
Junior Member
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0
Mattia86 is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

ma con quello che mi hai scritto serve per reperire le informazioni da PHP e metterle sul flash? o al contrario? cioè per spedire le variabili da flash a php ?

(scusate il doppio post)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 13-11-07, 14:39
Senior Member
 
Join Date: Jan 1970
Posts: 130
Rep Power: 39
nootropic.kint is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

serve per entrambe le cose..

con
Code:
loader.load(req);
mandi in post
Code:
req.method=URLRequestMethod.POST;
le variabili che hai in flash e hai formattato nel giusto modo per essere inviate
Code:
variablesToSend.formatData();
allo script php
Code:
req.url = _host + argv1 ;
e memorizza il risultato in loader.
se qualcosa va storto si solleva un'eccezione
(il perchè del try catch..)

magari è un po' confuso perchè ti ho scritto due metodi diversi..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
  #6 (permalink)  
Old 13-11-07, 15:58
Junior Member
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0
Mattia86 is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

sto leggend svariate guide oggi pomeriggio...
(veramente è da stamani che ci sono a scasinarci sopra, non son manco entrato all'università da tanto che ero preso...) ^_^

ho letto svariati metodi tra cui Sax, Dom e altri... e sinceramente le differenze non le ho capite molto...

ho trovato uno script che (da quel che ho capito ti modifica l'xml), ma non l'ho ankora testato..

ma io avrei bisgno che questo file xml venisse creato di volta in volta quando viene effettuata una modifica al database, così una volta aggiornato xml mi si aggiorna anke flash di conseguenza... è fattibile??

grazie a tutti
Mattia
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 14-11-07, 00:31
tem's Avatar
tem tem is offline
Moderator
 
Join Date: Jan 1970
Posts: 488
Rep Power: 39
tem is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

ciao!
certo che è possibile!

quando fai l'inserimento a database scrivi anche il file xml lato php..

nel mio blog le feed RSS sono create in questo modo..
http://www.thetconcept.com/blog

fammi sap se hai bisogno del codice per scrivere il file da php..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 21-11-07, 05:27
Junior Member
 
Join Date: Nov 2007
Posts: 8
Rep Power: 0
fan-manu is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

Unfortunately I dont understand Italian but there are keys words that are sticking out, and appear to be what I am looking for?

I was wondering whether anybody had figured a script or tutorial that I may be able to use that would allow me to; save an image created from swf, into a mysql database? I've managed to adjust the use of Fleps tutorial SWF to PNG Image but now want to try and alter the image, so that rather than displaying it, it gets saved directly into my database?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 21-11-07, 07:09
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

Hmm...nope, here they are not talking to save an image into a DB but i think someone can explane how to...

tem ?
__________________

 


I recommend: Essential Actionscript 3.0

- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
- I do not reply technicians pvt messages. Open a thread !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #10 (permalink)  
Old 21-11-07, 09:34
tem's Avatar
tem tem is offline
Moderator
 
Join Date: Jan 1970
Posts: 488
Rep Power: 39
tem is on a distinguished road
Re: Flash CS3, interazione con PHP MySql

Hi !
I've written you an example to load images in a Db with Php..

Here i'm doing the upload through an html form..

Code:
= $_FILES['file']['size']) {
 
require_once("db_connect.php");

 $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size']));
 $query = sprintf("INSERT INTO image(Image, FileType) VALUES ('%s', '%s')", $photo, $_FILES['file']['type']);
 if (mysql_query($query)) {
 $messages[] = "Your files is successfully store in database"; 
 } else {
 $messages[]= mysql_error();
 }
 } else {
 $messages[] = "The file is bigger than the allowed size (96k) please reduce your file size";
 }
 }
 ?>
 
 
 Add Image
 



 
 
Hope that it can help you..
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
Recuperare dati da mySQL con Flash CS3 Flep Articoli e tutorials 6 23-11-08 17:01
Retrieve data from mySQL with Flash CS3 Flep Tutorials 3 23-11-08 16:42
Actionscript 3 interazione swf esterni mauresp Actionscript 3.0 avanzato 0 14-10-08 10:37
How to get image from MYSQL into Flash hard_overclocker PHP | mySQL | Flash CS3 7 22-01-08 06:41
GuestBook in Flash CS3 - PHP - mySQL e XML Vlizzard AIUTO utilità free 1 25-09-07 18:48


All times are GMT. The time now is 19:47.


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


FlepStudio
by Filippo Lughi
P.IVA 03605860406