ActionScript 3.0 :: Undefined Variables In AS3 From PHP-MySQL?
Jul 18, 2011I can't seem to find the solution. Just a newbie in AS3 and trying to pass data from mysql to flash. Here's my code.
[code]...
I can't seem to find the solution. Just a newbie in AS3 and trying to pass data from mysql to flash. Here's my code.
[code]...
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader();
var urlRequest:URLRequest=new URLRequest("receive.php");
urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
I have a database with info about each of my movies (filename, size, length, credits, etc) How would I load the variables for a particular movie from the database into the flash?
I did a search on the forum, but I wasnt sure excatlly to search for so I didn't find anything.
I am using Freddy Thunder's tutorial on how to make a login script with php/mySQL The problem is that the button doesn't do anything when I click it. I can't tell if it goes to the php script, but it sure doesn't return the correct variables like it is supposed to.
View 3 RepliesI am using Freddy Thunder's tutorial on how to make a login script with php/mySQL
The problem is that the button doesn't do anything when I click it. I can't tell if it goes to the php script, but it sure doesn't return the correct variables like it is supposed to.
[URL]
When I pass a single variable (telephone) from Flash using the below it works fine
var xmlSaveLoader:URLLoader = new URLLoader();
xmlSaveLoader.load(new URLRequest("customer_insert.php?telephone="+teleph one));
I can read the variable in PHP using $key_telephone = $HTTP_GET_VARS[telephone];
and then run sql command to insert into table customers mysql_query("INSERT into customers (telephone) values ($key_telephone) ");
However, I have a problem and don't know how to pass multiple variables to PHP. I tried the following to pass a second variable (first_name)but it doesn't seem to work... xmlSaveLoader.load(new URLRequest("customer_insert.php?telephone="+teleph one+"&first_name="+first_name));
How can you bring in a path as a variable from php? I have hundreds of mp3 file names stored in a My SQL database and I want to call the name, load it into a variable and then have it replace the URL in the call to the sound file. I am all set with the PHP and database side of things, but I have been frustrated with the Flash part. I think it would just involve passing a variable from php to flash. The web pages we are building would eventually have 10 - 15 files per page and each one would have a different sound file and a different image that you could click to trigger the sound. First click would start the file and the second would stop the sound. The images and sound files are all stored in the database.I found this code on another post and it is basically what I want to do. Still missing the button part, but if I can figure out the variable from PHP I think it will open up a bunch of new options.
var soundRequest:URLRequest = "path/to/file.mp3"; //the path would be a variable passed from the database to php and then to the actionscript
var s:Sound = new Sound(soundRequest);
[code]....
I want to pass variables to php, then the php runs a query from the mysql database, and then sends back the new variable... I looked for tutorial, but nothin' seemed to work.
[Code]....
I'm trying to develop a simple as3 flash program that passes a collection a variables and returns a result based on the filtered results of a mysql table. Here is my as3 file:
[Code]...
No value is returned. If I replace with '$test4' and '$test5' with numbers such as 1 and 17, a value is returned. Where am I making a mistake?
I've been searching this problem for a while and have tried a number of solutions found on google but nothing has worked so far. I'm sure this is a common problem, but due to my lack of flash knowledge I can't logically work through it as I'm used to windows form development, it makes sense to me that the function could access the variables I have defined but they dissapear after the .onLoad event. Does anyone know the common solution to this problem? I want to be able to pass the xml details into the local variables so I can pass on the details into a dynamic text field when movies are hovered over etc.
[Code]...
Im trying to fetch some data from PHP and use it in a link in flash AS3. flash code:
[Code]...
[Code]....
I do not understand why i am getting undefined on the last trace.
I've been searching this problem for a while and have tried a number of solutions found on google but nothing has worked so far. I'm sure this is a common problem, but due to my lack of flash knowledge I can't logically work through it as I'm used to windows form development, it makes sense to me that the function could access the variables I have defined but they dissapear after the .onLoad event. Does anyone know the common solution to this problem? I want to be able to pass the xml details into the local variables so I can pass on the details into a dynamic text field when movies are hovered over etc
var myXML:XML = new XML();
myXML.ignoreWhite=true;
var nav1Text:String;
[code].....
I have a class like this..
public class Doc {
public function Doc():void {}
public var myVar:Boolean;
}
How can I know if the value held by myVar is default false, or someone has assigned false to it? Isn't there an undefined state? How can I achieve such a thing?
Trying to load some variables into flash I've done it before and it's work fine for some reason it's not working with this project.I get undefined values.Here's the embed code:
Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="650" height="650" id="Roulette" align="middle">
<param name="movie" value="roulette.swf" />
<param name="quality" value="high" />[code]......
I get this error 1120: Access of undefined property OtherClass.
Ths is the code:
Code:
public class SomeClass extends MovieClip {
function SomeClass():void {
} public function SomeFunction():void {
var i:int = OtherClass.myVar;
trace(i);
}}
Code:
public class OtherClass {
public static var myVar:int = 2;
public function OtherClass():void {
}}
I have a typical Flex-based application that was written to use a Java/Hibernate/MySQL backend. The client changed the requirements - now they want to distribute it on a CD where the user can just run the app without any installation or a network connection.
To do this, I certainly need to eliminate the web server and the database server and adapt my application (with as few changes as possible, of course) to a stand-alone application that will fit on a CD/DVD. I've managed to export the data to XML and read it into Flex, but I'm wondering if there's a way to recreate the Hibernate data structures in Flex so I could change as little code as possible. Failing that, is there any way to keep the existing Java/Hibernate external to the Flex code but retrievable without installing Apache Tomcat or MySQL?
I have a Flex application which manage a database composed by 7 tables.I have created the insert form and all work great. Now I wanto to improve the Form performances; the idea is to replace the TextInput of the Form with ComboBoxes which are provided by the DataBase tables
View 1 RepliesI have downloaded MySQL JDBC driver from [URL]... How do I configure it?
View 1 RepliesIn my table the Collation is:latin1_swedish_ci (but i tried UTF8_unicode too).In my flex application when it shows the table,it displays it correct,with all accent and pointing correct,but in the table is like :
View 1 RepliesI have a function that once called creates some new variables
function createPane(event:Event):void
{
var manager:IPaneManager = map.getPaneManager();
[code].....
I loaded and then trace my _global variables for three screens and they follow me fine until,. then on the the screen i have tiny bit of code:
[Code]...
Could it be the level 99 I use. I tried using 0 and it did not work? I have tried doing this for way too long,
I have a PHP file located at http:[url]....which looks like
Code:
<?php
$one = 40;
$two = 60;[code]........
which is basically the code to create a pie chart.Is it possible to use the variable "onev" in frame 1 for the value in my movieclip "share_value[0]",and use the variable "twov" in frame 1 for the value in my movieclip "share_value[1]",so basically my PHP variables are used to control the values on
Code:
share_value[0] = 40;
share_color[0] = "0x82b1cf";
share_value[1] = 60;
share_color[1] = "0xb4cfe2";
I have been hacking around with this for days and tried so many things, such as setting global variables etc, but nothing seems to work and I either nothing or I get "undefined" in my output box.
When I don't include the "www" in the URL, the variables do not populate. When I do include it, they populate just fine... CHeck it out
[URL]
I talked to the hosting company and they claim that the problem isn't something on their end. They tell me its something in my code. Would it be in the html, php or my actionscript. I'm using AS 2.0.
im having problems getting some as3 generated (not drawn on stage) movie clips moving across the screen.
Code:
package {
import flash.geom.ColorTransform;
import flash.display.MovieClip;
import fl.motion.Color;
import flash.display.*;
[code]....
i am using flash, .Net, and MySQL and have elements (text fields) posting in flash.Question is, if the table in the data base is not holding the var char how can I set the text field in flash to not show undefined and just be blank?
View 6 RepliesI have an empty SWF that's sole purpose is to call loadMovieNum and start the project. Each loaded movie has a few variables defined within them - unique to those loaded SWFs. Instead of declaring all the variables in each SWF can I declare all of them in one place, in the first frame of the empty loader it all starts from? I'm thinking I can then declare a variable which each loaded movie can increment as needed for me.
View 2 RepliesHow do variables true/false custom variables work in flash?
For example, what I want to do is create a simple true=false variable that I can call on an if statement later.
For example:
Code:
Var1 = true;
if (!Var1)
{
[Code]....
I noticed that neither the "Var1 = true;" part or the if(!Var1) part worked in flash.
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 RepliesI have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don't seem to work the same way. I have tried moving the string array to give it full scope, and still nothing...
public class test extends Sprite
{
// Declare a list of strings
protected var title0:String = undefined;
[Code]....