xcandiottix Posted March 13, 2010 Share Posted March 13, 2010 Does anyone have experience getting php variables into flash? I've tried a lot of different how-to's online but they are vary too much to get anything working. I'd like something very basic just to get it to work.. after that I can make it do what I want. Currently, I've set up a PHP page that gets my needed variable and then: print var1 = cheese In flash, I've tried a variety of ways to get var1 into a text box but nothing seems to work. If I go to the php page it prints: var1=cheese So I know the php side is OK... just no luck with the flash import. I'd rather not go the PHP - XML - Flash route if possible. Thanks. Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/ Share on other sites More sharing options...
teamatomic Posted March 13, 2010 Share Posted March 13, 2010 I use swishmax for flash, if you do say so and I'll help you. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1025717 Share on other sites More sharing options...
xcandiottix Posted March 14, 2010 Author Share Posted March 14, 2010 I haven't heard of swishmax, could you tell me about it? Does it just act as a transloader for the variables between flash and php? I can provide my code so far if that helps any. Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1025795 Share on other sites More sharing options...
teamatomic Posted March 14, 2010 Share Posted March 14, 2010 Swishmax is an app that makes swf files. Just easier to use that the real flash app. Has its own scripting. http://www.swishzone.com/index.php?area=products&product=max HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1025797 Share on other sites More sharing options...
xcandiottix Posted March 14, 2010 Author Share Posted March 14, 2010 Ah... well the flash itself isn't my problem really as I have specialized in flash but this is my first experience with PHP. I've set up the flash coding a few different ways, similiar to how I would make it read from an XML but for some reason it just won't pull the vars. I'm thinking it may have more to do with my php script rather then the flash side but who knows. My php is as follows: scorecard.php?file=TEST <?php $file="'{$_GET['file']}'"; if($file) { $con = mysql_connect(".com","DB","PW"); mysql_select_db("DB", $con); $sql = "SELECT UserName, Rating FROM comments WHERE UserName = '{$_GET['file']}'"; $result = mysql_query($sql) or die("<b>error</b>: failed to execute query <i>$query</i>"); $desiredContent = mysql_fetch_array($result); mysql_free_result($result); echo "Rating=$desiredContent[Rating]"; } ?> My Flash is as so: Main Stage Contains a Movie Clip which Contains a Dynamic Text Box called Ratings onClipEvent (load) { loadVariables("http://www.dyno-charts.com/scorecard.php?file=TEST", this, "GET"); } also tried onClipEvent (load) { Rating = new LoadVars(); Rating.onLoad = handleLoad; Rating.load("http://www.dyno-charts.com/scorecard.php?file=TEST",this,"GET"); function handleLoad(success) { if (sucess) { //news_txt.htmlText = this.siteNews; textbox.htmlText = this.scorecard; } else { textbox.htmlText = "<b>file not found</b>"; } } } this one prints 'file not found' in the dyn text. Any thoughts? Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1025798 Share on other sites More sharing options...
decpariem Posted March 14, 2010 Share Posted March 14, 2010 first of all create a function: newfunction= new LoadVars; then do this. newfunction.sendAndLoad("yourphpfile.php",newfunction,"GET"); In your php file you should echo status="ok" and then in flash if ( newfunction.status="ok") { whatever you like.} for any further questions tell me. php mistake: WHERE file = '" . $_GET['file'] . "' Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1025895 Share on other sites More sharing options...
xcandiottix Posted March 16, 2010 Author Share Posted March 16, 2010 Thanks for the reply ... you said to change: WHERE UserName = '".$_GET['file']."' to WHERE file = '".$_GET['file']."' but doesn't WHERE xxxx need to be a column in my data base? So where column user name is equal to the GET statement. Since I am passing along the user name in the previous page ...scorecard.php?file=TEST Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1027175 Share on other sites More sharing options...
xcandiottix Posted March 18, 2010 Author Share Posted March 18, 2010 I decided to go the XML route as it's not as big of a deal as I first thought. There's a really nice tutorial here: http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1027971 Share on other sites More sharing options...
decpariem Posted March 18, 2010 Share Posted March 18, 2010 Of course. I only meant the punctuation not the name. The name was my mistake! Link to comment https://forums.phpfreaks.com/topic/195149-php-into-flash/#findComment-1028110 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.