Help with flash and php prlblem
the problem is flash receive the data back after send
loadvars.but it always got it wrong.
code in flash is:
send_btn.onRelease = function() {
myVars = new LoadVars();
myVars.username = username_txt.text;
myVars.phonenum = phonenum_txt.text;
myVars.picktime = picktime_txt.text;
myVars.email = email_txt.text;
myVars.address = address_txt.text;
myVars.shortmessage = shortmessage_txt.text;
myVars.onLoad = function(success) {
if (success) {
if (this.order) {
gotoAndStop(2);
} else {
gotoAndStop(3);
delete myVars;
myVars.sendAndLoad("sendorder.php", myVars, "POST");
and code in php is:
$username = $_POST['username'];
$phonenum = $_POST['phonenum'];
$picktime= $_POST['picktime'];
$email = $_POST['email'];
$address = $_POST['address'];
$shortmessage= $_POST['shortmessage'];
$result=mysql_query("insert into
userinfo(email,username,phonenum,address,picktime,message)
values('$email','$username','$phonenum','$address','$picktime','$shortmessage')");
if($result){
echo "order=1";
}else{
echo "order=0";
flash reponse after receiving the varaible from php is always
go to frame 3
but the test of php is output order=1.
what is wrong with it?please help::^_^
interesting b, but i think i see something else here that is
the reason you needed to add the '&'. You're passing back a
number value (ie. 0/1) and treating it as a boolean (all fine)
except that in the echo statement it's all inside quotes, so it's
being interpreted as a complete String. to remedy, try writing the
echo like this:
if($result) {
echo('order='.1);
}else{
echo('order='.0);
and you're welcome :)
Similar Messages
-
High Score Table: Writing a Simple Text File with Flash and PHP
I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I could check that the server was running PHP - the files were also uploaded to a remote server so I could test them properly. Flash code is as follows:
//php filewriter
var myLV = new LoadVars();
function sendData() {
//sets up variable 'hsdata' to send to php
myLV.hsdata = myText;
myLV.send("hiscores.php");
I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
<?php
//assigns to variable the data POSTed from flash
$flashdata = $_POST["hsdata"];
//file handler opens file and erases all contents with w arg
$fh = fopen("scores.txt","w");
//adds data to file
fwrite ($fh,$flashdata);
//closes file
fclose ($fh);
echo 'php file is working';
?>
Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.Thanks for your help.
I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
var outLV = new LoadVars();
var inLV = new LoadVars();
function sendData() {
outLV.hsdata = "Hello from Flash";
outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
inLV.onLoad = function(success) {
if (success) {
//sets dynamic text box to show variable sent from php
statusTxt.text = phpmess;
} else {
statusTxt.text = "No Data Received";
This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
<?php
$mytxt =$_POST['hsdata'];
$myfile = "test23.txt";
$fh = fopen($myfile,'w');
//adds data to file
fwrite($fh, $mytxt);
//closes file
fclose ($fh);
$mess = "hello there from php";
echo ("&phpmess=$mess&");
?>
The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated. -
Need Urgent Help with Apache and PHP
I have been struggling with apache and php for a week now and I finally broke down to post a message.
I have apache 1.3 running on my mac mini g4 with 10.4.9 and I installed sql. I went to the entropy website and downloaded php5 to install without knowing I already had php4 on the machine. I installed 5 but could not get it to work. I then went back to httpd.conf and tried to install php4 by uncommenting out the loadmodule and addmodule lines. I restarted apache but php still did not work. I tested the phpinfo.php script but all I got was the script in Safari and not the actual page. At the moment, I have php4 and php5 on my machine but can't get either one to work. I am sure there is an easy fix but I don't know it. Please help.The problem is not terribly complicated, but Apache will not start with the entropy file in the folder
/etc/httpd/users/
Let me experiment on you. Rename the entropy file and then try to start Apache. To do this, open Terminal and paste this command:
<pre>sudo mv /etc/httpd/users/+entropy.conf /etc/httpd/users/+entropy<pre>
Now check the Apache configuration:
<pre>apachectl configtest<pre>
If it says "Syntax OK", start Apache:
<pre>sudo apachectl start<pre>
Since we only disabled the entropy file, you should be able to enable PHP5 with some more advanced configuring. -
Using databases with Flash and PHP
Hi, everyone!
I`m a PHP newbie. I just learned PHP so that I can use
databases with Flash.
I`ve got a .php script that contains html that loads up my
.swf file. The .swf file is the core of my site. What I want to
know is if I can call some PHP functions (that I have wrote in the
.php script) from within the .swf file... This functions would
perform the reading and updating of my database.
The only way I know of to modify a database from Flash is
using the POST and GET methods. But that opens up a new browser
window in which the PHP script is called. And that only handles
writing in the database. So, what if I just want to read from the
database some values and insert them into a TextField in Flash? How
do I do that?
Thanks! Ardy1. Goggle "Flash and mySQL" and you'll get a listing of alot
tutorials
2. I'm also just learning. Here's a great URL to start:
Building with Flash and MySQL
That's right, a Flash-based blog — it sounds a little
loony, but this blog pulls content from a MySQL database and feeds
it into the dynamic Flash frontend ...
www.webmonkey.com/programming/php/tutorials/tutorial2.html -
20k - Cached - -
Need help with FlashVars and PHP
I'm trying to pass a variable (an mp3 URL) generated from a SQL query with PHP to a small flash mp3 player embedded in the page. I am using FlashVars and its not receiving the .swf is not receiving the variable.
Here is the embed code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="35" height="35">
<param name="movie" value="http://www.myurl.com/audioButton.swf" />
<param name="quality" value="high" />
<param name="FlashVars" value="theFile=<?php echo $myaudio; ?>" />
<embed src="example.swf" width="550" height="400" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="theFile=<?php echo $myaudio; ?>"></embed>
</object>
I've declared the variable at the top of the page like so:
$myaudio = "http://www.myurl.com/demo.mp3";
When I load the page, the flash player doesn't play the mp3. But if I put the mp3 URL directly into the embed code (see below) it works ...
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="35" height="35">
<param name="movie" value="http://www.r2creative.com/audioButton.swf" />
<param name="quality" value="high" />
<param name="FlashVars" value="theFile=http://www.myurl.com/demo.mp3" />
<embed src="example.swf" width="550" height="400" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="theFile=http://www.myurl.com/demo.mp3"></embed>
</object>Ok. I see where my problem is. What I'm ultimately trying to do is query a database of podcasts, and when they are displayed on a php page, have a small flash button next to each which streams the audio.
I was placing the entire embed code of the flash player and placing into a field in the database (audioPlayer) and using another field (mp3Link) a the source. The page was displaying the players next to the podcasts but there was no audio.
I just placed the embed code directly into the page and it works, so the flashvars problem is solved - outputting the embed code from the database must not work for some reason. I'm still not sure how I'll accomplish this, but I know now that the swf was receiving the variable.
Thanks guys. -
Quick help with flash and html
Hi folks,
just a quick query that i'm sure someone out there will know
the answer to (or at least i'm hoping someone will)
I've been working on a new site (first attempt so be gentle
with any criticism please!!)
I used fireworks8 to create a navmenu and it works a treat,
however i also have flash on some of the pages, and the fireworks
submenus don't seem to like showing up over the flash!
see
http://www.gammies.co.uk/construction.asp
for what i mean. the nav links to construction, groundcare and
recreational don't show becuase of the flash. I was trying to see
if there was some option to send the flash to the back of the page
as such so that the navmenu was on top but couldn't get it, and i'm
no sure what i'd have to do code wise to change it (if it's a code
issue). By the way it does it in both firefox and IE
All help greatly appreciated..
Thanks
ChrisAll Active content on a page will always rise to the top, so
to speak,
including Flash, certain form elements, Java applets, and
Active X controls.
This means that each of these will poke through layers. There
is not a good
cross-browser/platform reliable way to solve this issue, but
if you can be
confident in your visitors using IE 5+ or NN6+, then you can
use the Flash
wmode parameter (however, Safari does not support this
properly!).
Adobe articles:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15523
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14201
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"[email protected]" <[email protected]>
wrote in message
news:foc4db$2nh$[email protected]..
> Hi folks, just a quick query that i'm sure someone out
there will know
> the
> answer to (or at least i'm hoping someone will) I've
been working on a
> new
> site (first attempt so be gentle with any criticism
please!!) I used
> fireworks8 to create a navmenu and it works a treat,
however i also have
> flash
> on some of the pages, and the fireworks submenus don't
seem to like
> showing up
> over the flash! see
http://www.gammies.co.uk/construction.asp
for what i
> mean.
> the nav links to construction, groundcare and
recreational don't show
> becuase
> of the flash. I was trying to see if there was some
option to send the
> flash
> to the back of the page as such so that the navmenu was
on top but
> couldn't get
> it, and i'm no sure what i'd have to do code wise to
change it (if it's a
> code
> issue). By the way it does it in both firefox and IE All
help greatly
> appreciated.. Thanks Chris
> -
I have just completed my website(www.Aquiteoddsite.com).
It is a variety cartoon site for my partner and I. We where
going to upload the file the other day but when we put it on an
HTML page- The Audio was happing abut a second before the
animation. I then checked to make sure it was not in the actual
file. I wacthed it by itself and it worked fine. Then I tried again
to toput it on an html page- once again it wigged out. Finnaly I
tried to put it on a different site and it still failed o work
properly. I don't remeber futzing around with my publishing
settings either.
If you be so kind as to help me, we would greatly apprecate
it. to the 5th power.
Thanks in advance. Quite Odd.All Active content on a page will always rise to the top, so
to speak,
including Flash, certain form elements, Java applets, and
Active X controls.
This means that each of these will poke through layers. There
is not a good
cross-browser/platform reliable way to solve this issue, but
if you can be
confident in your visitors using IE 5+ or NN6+, then you can
use the Flash
wmode parameter (however, Safari does not support this
properly!).
Adobe articles:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15523
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14201
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"[email protected]" <[email protected]>
wrote in message
news:foc4db$2nh$[email protected]..
> Hi folks, just a quick query that i'm sure someone out
there will know
> the
> answer to (or at least i'm hoping someone will) I've
been working on a
> new
> site (first attempt so be gentle with any criticism
please!!) I used
> fireworks8 to create a navmenu and it works a treat,
however i also have
> flash
> on some of the pages, and the fireworks submenus don't
seem to like
> showing up
> over the flash! see
http://www.gammies.co.uk/construction.asp
for what i
> mean.
> the nav links to construction, groundcare and
recreational don't show
> becuase
> of the flash. I was trying to see if there was some
option to send the
> flash
> to the back of the page as such so that the navmenu was
on top but
> couldn't get
> it, and i'm no sure what i'd have to do code wise to
change it (if it's a
> code
> issue). By the way it does it in both firefox and IE All
help greatly
> appreciated.. Thanks Chris
> -
Help With HttpURLConnection and PHP
I can connect to a site with HttpURLConnection but i need to access a link FROM that site.
Ex: www.hangman/index.php
I need to get a link like www.hangman/index.php?letter=a
It will only display the letter if you go from www.hangman/index.php and click on the letter. But how do i do that with HttpURLConnection.
I think you have to use the POST , but it doesnt work.
Thanks.That's probably because the site uses cookies to maintain a session.
The cookie's name is PHPSESSID, so I'm guessing this is a standard PHP session maintenance system (I haven't worked with PHP much...).
So if you want to create a java app that will play hangman from that site, it looks like you'll have to handle cookies to keep the session active between accesses. So you'll grab the cookie from the response headers in the first connection, and then send it to the server in the request headers in subsequent connections. The cookie may remain the same throughout the session, or it may change on each connection; I don't know.
I did a quick google and found this:
http://jcookie.sourceforge.net/
I haven't used it myself, but it looks useful. Unless you're doing this as a learning exercise, it's probably easier to use this than to wrote your own cookie code. -
I'm new with flash and don't know why the timers don't work like i would expect. In VB.NET timers are how you move stuff, but it doesn't look like they are ideal for moving stuff in flash at all (really slow). I'm making a game in which you throw a ball around the screen. i am using a timer to get the ball to move. this doesn't work well for 2 reasons; 1: the ball jumps alot, and 2: the timer should eventually run out of time. If anyone can help, i'd be thrilled cus this is my first post here, so yeah
Timing for movement would be more often dealt with using something that operates at the frame rate of the file. The ENTER_FRAME event is usually selected for this purpose.
stage.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(evt:Event):void {
// your positioning code
You could use a Timer to control when to stop the listener from being active. -
What's With Flash and IE7 ?
I have noticed a number of posting of Flash and IE7 troubles,
but they are not close enough or succinctly worded enough to suit
me to glom onto their post with my problem, and I noticed that the
ones who have a problem similar to mine are not being answered. So,
I take it that there is definitely a problem with Flash and IE7,
but no one knows the answer and Microsoft has not risen to the
problem of dealing with a problem that affects hundreds of
thousands of users. I have posted the following on a Microsoft
forum, but have received no reponses there as of yet. Hopefully the
Flash gurus here will be able to rise to the occasion more quickly
than their Microsoft IE counterparts.
If you look at the home page for
http://www.townofstarprairie.com/
using FireFox or IE 6 (with security settings lowered), you'll
notice a scrolling flash text box at the top, and an exact
duplicate of that text box at the very bottom of the page.
If you use IE 7, the one on top does not show but the one on
the bottom of the page does. These two Flash boxes are identical in
every way.
I have toyed with my IE 7 settings to the point where IE was
screaming at me that the world was going to come to an end due to
my low security settings, and still the one on top does not show.
What ever could be the problem with this?
Thank you for any help you can provide!Nickels55, you are correct....mostly.
One of my acquaintances busted into the weather.com code and
sent me the source. After much trial and error, I found that by
removing the STYLE block completely, I no longer had a problem. I
even tried removing the styles between the STYLE block, but that
didn't work. I had to remove the STYLE tags, too. I tried linking
out to a style page to no avail , btw.
For a while, you can see a bust of this problem at
http://www.townofstarprairie.elitecyberdesign.com/index.cfm?optionid=5877
What's really weird is that this problem only affects the
Flash code ABOVE the Weather.com widget (you would think it would
affect below, but such is not the case), and only in IE 7.
Very strange. -
Populating a Combobox using Remoting with AMF and PHP
Hello all
I am using Zend framework and Flex 3.4 to create a webapp. I am stuck at how to populate a combobox dynamically using the service I created in PHP.
In some of examples I saw that result of database query was being converted into XML and then sent to Flex. This seems a little too time-consuming if I have to do it every time. I saw some examples in Adobe Docs about Remoting with AMF and PHP. That seems like a better approach although how it would be applicable here is beyond me right now.
Can somebody guide me in correct direction?
Thanks and Regards
ShivikTry this: http://code.google.com/p/as3flexdb/ is very easy to use and it
will help.
All you need to populate a combo is:
<mx:ComboBox dataProvider="{query.Records} / -
Need help with Flash CS4 buttons/can't get buttons to control anything
Hello,
I need help with Flash CS4. I am making a banner with an animation (Image change into movie clip "3D Spiral") and added buttons but I cannot get the buttons to control the animation. Please help I am frustrated! If someone could help I would be most appreciated.Thank you.
Regards,
Michael J. Sheehan allelois
Date: Mon, 17 Aug 2009 18:48:09 -0600
From: [email protected]
To: [email protected]
Subject: Need help with Flash CS4 buttons/can't get buttons to control anything
Hi there
I'm not sure how you wound up where you did. But you wound up in the Adobe Captivate forums. Please stand by as I move your thread to the Flash forums.
Cheers... Rick
> -
Array data between Flash and PHP
As the title suggests, I'm trying to find a good way of
getting an ActionScript/Flash dynamic array into PHP, so I can
serialize it and store it in a DB, then simply give back that same
array when it's called. Are there any popular techniques? The array
will always be a different size, containing different values -
which is why I'd like to keep the array in tact, to minimise the
amount of parameter transfers. If there's no good solution, I
suppose I could pass in parameters and read them in, create an
array and serialize that... but I'd much rather find a way of
having my flasher serialize his own array and pass me the
byte-code. Is this possible?
PHP doesn't need to read the contents of the array, simply
store it in a DB, so if there's some kind of flash method for
serializing an array into bytecode that it can unserialize and read
back later, that would be awesome.
Thanks. =]
[edit]
I found this:
http://sourceforge.net/projects/serializerclass/
a serializer class. Is this the best method?Sorry, I should have explained, we already use XML for data
transfers (though I personally find JSON much nicer with less
overhead). So, in this project, we use XML for data transfer
between flash and PHP/Database. The reason I wanted this
functionality, is because the flash array, in this one case, will
be completely dynamic and the PHP doesn't need to know the contents
of the array at all. In fact, in this instance, PHP is just the
mechanism used for storing the data. Becuase of the nature of the
data, I wanted to serialize the flash array, store it in the
database as Bytecode, then when the flash needs that information
again, I can pass back the same bytecode, which can then be
unserialized back into the original array.
I think I've found the solution, the one I linked in the
original post. I should know if it's as effective as I want it to
be in the next couple of days when my flasher gives it a try. =]
Thanks for the responses. If anyone has any other ideas,
please throw them in here. -
Still need help with flash player download
I'm still having a problem with the flash player, please read my last post below:
"I've tried everything here & still can't download the flash player. Anytime I try to download it asks me to install ADM add-on and then when I click on that, my computer freezes. How do I enable this add-on without my computer freezing? Can anyone help pls?"Thanks a lot for your help, it is truly appreciated.
Date: Thu, 29 Oct 2009 18:52:38 -0600
From: [email protected]
To: [email protected]
Subject: Still need help with flash player download
You can set Flash Player to check for updates on the Global Settings Manager panel:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager05.htm l
> -
Help with flash video buffering
I need help with flash video buffering. I've created a
buffering graphic to show up when the clip is loading. The problem
that I'm having is that when the video finishs playing, the buffer
is empty and the graphic pops back on. The following is the code
that I'm using to call and buffer the video. Any help would be
great!
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(10);
ns.onStatus = function(info){
if(info.code == "NetStream.Buffer.Full"){
bufferClip._visible = false;
if(info.code == "NetStream.Buffer.Empty"){
bufferClip._visible = true;
if (info.code == "NetStream.Stop") {
bufferClip._visible = false;
theVideo.attachVideo (ns);
ns.play("my_clip.flv");
rewindButton.onRelease= function(){
ns.seek(0);
playButton.onRelease= function(){
ns.pause();
}Again thank you for your help in advance...
I put the script folder into the root. As far as the .flv
file it is showing up as being "put" to my web server. when i
checked the root folder it is there. again i am having the same
problem.. the local view works but when i check it on the web it
just shows that there should be a flash video there but it does not
show up.
i created a new root for this test page the new link is..
http://www.wfwa.org/TESTindexfolder/TESTindex.asp
here are the files that are showing up in it...
flashprojectwebvid.fla
flashprojectwebvid.html
flashprojectwebvid.swf
PBSpromo.flv
SteelExternalPlaySeekMute.swf
TESTindex.asp
and the Scripts folder
thanks again for any help..
Maybe you are looking for
-
Can I share my internet connection from macbook pro to macbook air?
Hello. I've tried to share my internet connection using wifi, two computers were connected with each other, but one had not internet connection. What can I do to fix it, and have internet access on both computers?
-
I have created a new custom SBDoc which is an exact copy of SAP standard SBDOC CAPGEN_OBJECT_WRITE. I have activated, generated and released the BDoc. I have created subscriptions for this new SBDoc for a site. However, when a BUPA_MAIN MBDoc is rece
-
Importing XML into oracle 11g database
I am having some difficulty parsing an XML file into oracle 11g database. Currently using Oracle 11g Express Edition (XE) Here is how my XML file looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <AccountMap xmlns:xsi="http://www
-
Urgent, compilation problem in Unix
SET JSRCPATH=D:\app\a\*.java D:\app\b\*.java D:\app\c\*.java D:\d\*.java D:\app\e javac %JSRCPATH%\*.java My makefile script above is OK in WinNT environment. But when I use it in Unix (of course I have changed the directory path), it has problems: I
-
Disappearing links when importing snippet...
OK, so I have two snippets, both contain a Rectangle with an Image child. In one of them, that is all I have. In the other, the Rectangle is part of a group with another item. After importing the snippet, I relink to fix the image paths. On desktop,