RE: [PHP] FLASH AND PHP

From: Date: Wed, 04 Apr 2001 15:01:34 +0000
Subject: RE: [PHP] FLASH AND PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47064@lists.php.net to get a copy of this message
If you put this code behind a button in Flash 5 (for example): on (release) { //Construct and XML object to hold request type requestXml = new XML(); requestElement = requestXml.createElement("REQUEST"); requestElement.attributes.request = "<MyRequest/>"; requestXml.contentType = 'text/xml'; requestXml.appendChild( requestElement ); requestXml.contentType = 'text/xml'; //Construct an XML object to hold the servers (webobject's) reply requestReplyXml = new XML(); requestReplyXml.onLoad = onRequestReply; //debug requestXml.xmlDecl = "<?xml version=\"1.0\" ?>"; trace( "Request sent" ); trace( requestXml.docTypeDecl ); trace( requestXml.xmlDecl ); //Send the request object to the server cRequest = "Sent request..."; requestXml.sendAndLoad( "http://www.foo.com/dataretriever.php", requestReplyXML ); cRequest = "Waiting For Reply..."; } function onRequestReply () { //Get the first XML element var e = this.firstChild; var _level0:TotalStoreNumber = 0; var i = -1; if( e != null ){ do { if( e.nodeName == "REQUESTREPLY") e = e.firstChild; else //Do what you want with the xml data //------------------------------------ if( e.nodeName == "STORE") { cStoreList += ( e.attributes.NAME + " - " + e.attributes.ADDRESS + newline ); if( i == -1 ) i = 1; else i++; eval( "_level0:n" + i ) = i; eval( "_level0:s" + i ) = e.attributes.NAME; eval( "_level0:c" + i ) = 111; } e = e.nextSibling; } while( e != null ) } } dataretriever.php can then query your DB/build an xml document (see php.net on how to read/create XML files in PHP) and output it as normal. Flash will recognise the xml and then you can parse the xml doc returned from your php script and build the flash object accordingly. Of course, you don't have to pass xml to your php script, you could just pass a URL parameter but xml gives you a great framework for expansion without breaking existing code. This line is the key: requestXml.contentType = 'text/xml'; and you won't find it mentioned in the current flash 5 documentation! HTH > -----Original Message----- > From: Godd [mailto:godd_mapp@hotmail.com] > Sent: Tuesday, April 03, 2001 8:57 PM > To: php-general@lists.php.net > Subject: Re: [PHP] FLASH AND PHP > > > EXPLAIN !!!!!! > > I am not an XML expert > > Please explain. I have only now begun to read up on XML > > > > > ""Richard Kirk"" <rkirk@rkirk.com> wrote in message > news:000d01c0bc55$6db38ee0$7200000a@proj00014... > > Or alternatively use the xml object to send an xml (flash 5) document to > php > > which then waits for an xml response. > > > > Cheers > > > > > -----Original Message----- > > > From: Lindsay Adams [mailto:lindsay@dingos.net] > > > Sent: Monday, April 02, 2001 10:00 PM > > > To: PHP > > > Subject: Re: [PHP] FLASH AND PHP > > > > > > > > > If you are wanting to use pregenerated FLASH scripts ( and not > > > build them on > > > the fly with libswf or ming) then what you want to do, without > > > having to buy > > > Generator for your server is... > > > > > > In the beginning of you falsh file, do a load variables from > a PHP page, > > > that queries a database or whatever, gets the data, and echoes it > > > out to the > > > FLASH file in the format expected by load variables. Tack on > a variable > at > > > the end called loadDone and set it to 1 (or true) > > > In flash, you have to put in a loop in the second frame, or after the > > > loadvariables command, that checks to see if loadDone==1, to make > > > sure that > > > all the variables have loaded. > > > > > > You cannot assume that the variables will load within a certain > > > time period. > > > If they don't, the rest of your scripts will break. > > > > > > That, is how you can pass a lot of dynamic information into your > > > flash file, > > > without the use of server side generator install from macromedia. > > > > > > > > > > > > On 4/2/01 11:14 AM, "Godd" <godd_mapp@hotmail.com> wrote: > > > > > > > Now VRML and PHP may be possible but if you can get Flash to > > > get in the mix > > > > that will be so bad. > > > > > > > > What I really want to do is to get a flash file that will use > > > the pictures > > > > that I send to it via php and let it use that picture to do the > > > animation. > > > > > > > > Now what I am looking at is a flash file that displays info on > > > a product. > > > > now given the picture of the product and the information on the > > > product, I > > > > want flash to use that info with the events that I will place > > > in the flash > > > > file and let it do its thing. > > > > > > > > now that will be good. I am not sure what macromedia has along > > > this line. > > > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#47064) next »