Re: Re: 3d modeling-php

From: Date: Wed, 22 Nov 2006 00:52:11 +0000
Subject: Re: Re: 3d modeling-php
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-245008@lists.php.net to get a copy of this message
At 08:07 PM 11/21/2006, J R wrote:
yes for this project i think you'll better off with flash and if you want to interact with server side there's an open source project called amfPHP [1]. It is a flash remoting solution, using php on the server side. i'm not sure of its current status. hth, john [1] www.amfphp.org <snip>
It's not a big deal from the Flash side, you use either sendAndLoad() or if your data is more complex and structured, then XML() to call a PHP script. A lot of Flash examples use files loaded from the file system. I did not use amfPHP because when I needed to do this the first time work on that library seemed to have halted. I think it's really provided so that Flash designers / developers have an alternative to Flash Remoting which can simply be "used". Make certain your PHP script generates properly formed XML. As this was text, with unpredictable content, I had to use CDATA[], otherwise parsing the XML on the Flash side was very unpredictable. There are a couple of libraries to parse XML on the Flash side which eases that part of the work. Here's an example, using Actionscript to call a PHP script in Flash to retrieve the news stories for a given day from the database. getNodes() and displayContent() are custom functions, so don't look in the manual. Host is set in an .as file. This is Actionscript 2 (AS2); Flash is now up to Actionscript 3 I believe. Caution: The format of some functions changed between AS1 and AS2 and the Flash compiler DOES NOT TRAP THE DIFFERENCE. A good example is sendAndLoad() which used to be SendAndLoad(). No complaint about an unknown function, but suddenly the movie just-did-not-work. I've not worked with AS3 so don't know about any of its quirks. As for the formatting, the way the tabs blew out reinforces argument someone made for spaces earlier today. I don't do that, I set a tab to be equivalent to 3 spaces in all my editors. As for the style of braces, these days I tend to put the left brace immediately following the function name. Hope this will be helpful. Regards - Miles function getStories(dtChosen) {
        var xmlReceiver:XML = new XML();
        xmlReceiver.ignoreWhite = true;
        if( dtChsn == "" )
        {
                xmlReceiver.load( "http://" + host + "feedNewsXml.php");
        }
        else
        {
                xmlReceiver.load( "http://" + host + "feedNewxXml.php?dtArticle="+ dtChsn);
        }
        xmlReceiver.onLoad = function( success:Boolean )
        {
                // If the vars loaded successfully...
                if (success)
                {
                        arrHeads = getNodes( this, "head");
                        arrShrtHeads = getNodes( this, "shrthead" );
                        arrStorys = getNodes( this, "story");
                        displayContent(arrShrtHeads);
                        txtNews.text = "<b>Click a headline on left to read the news story.</b> <br><br>"
                        txtNews.text += "To scroll either headlines and news story, use: <br>"
                        txtNews.text += "               <i>Page Up and Page Down keys</i>, or <br>"
                        txtNews.text += "               <i>Mouse wheel</i>. <br><br>"
                        txtNews.text += "Remember to click in the frame you want to scroll."
                        txtNews.selectable = False;
                        newsPos.ChkPos();
                } else
                {
                // Otherwise tell the user the vars couldn't be loaded.
                txtNews.text = "GetStories: Loading of news storys failed.";
                } // end if (succes ..
        } // end varReceiver.onLoad
} //end function GetStories() 
-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.11/543 - Release Date: 11/20/2006

« previous php.general (#245008) next »