ActionScript 2.0 :: Using LoadVars.getBytesLoaded And LoadVars.getBytesTotal?
Sep 1, 2003Whenever i try to display anything returned by LoadVars.getBytesLoaded or Load....Total, it gives me NaN.
View 14 RepliesWhenever i try to display anything returned by LoadVars.getBytesLoaded or Load....Total, it gives me NaN.
View 14 RepliesI am using Flash CS3 with ActionScript 2 and am having a problem getting getBytesLoaded and getBytesTotal to work properly. Probably I am taking the reading in the wrong spot, but I can't figure out where I should be doing it. The code will read an xml file which contains pictures and url links to where I want each picture to go, and then loads and shows a picture for 3 seconds, then goes on to the next one. I am trying to show the preloader bar "LOADING" by adjusting the _xscale as a percentage of BytesLoaded/BytesTotal. The code should work, but my getBytesLoaded and getBytesTotal is either showing 0% or 100% and nothing in between. Here is my code and I have left some of my trace statements in the code below as well. The problem occurs in the this.onEnterFrame = function() which is about half way thru the code:
[Code]...
One of the moderators, could you've a look at this tutorial: [URL] it doesn't works with me, maybe because I've 2004 so if you change loadVars() into LoadVars() it should work
View 2 RepliesOK, I am trying to do my first simple user authentication for a test built in Flash. I'm just checking to see if someone with the same name and email exists in the mySQL database and then echoing out entryAllowed=false if they exist.
Code:
PHP Code:
//query is successful and these vars trace out in flash
[code].....
I have created a site that calls in text from an external .txt file. The text file is a flat file that is updateable using PHP. What I need is for the Flash site to reflect the current contents of the text file each time it's updated through the PHP interface. I'm using the standard:
myData = new LoadVars();
myData.onLoad = function() {
text_txt.text = this.blog;
[Code].....
I did get it to 'kind of work' at one point, but the output text would flash 'undefined', then show the contents of my text file, then go blank then start that loop over again. Not acceptable.
I keep getting this error when I try and load a text file in a dynamic text field.
'The identifier 'loadVars' will not resolve to built-in object 'LoadVars' at runtime.'
This is my code:
Code:
on (release) {
loadText = new loadVars();
loadText.load("text1.txt");
[Code].....
I want the file 'text1.txt' when I load frame 1, then when I move to frame 2 it will load 'text2.txt' etc etc right upto 20.
I want to load data from a text file with four elements (account, first name, last name, club status). There are 88,000 accounts.
[Code]...
I am converting a class into AS3 (was AS2). What would be the best way to replace the loadVars ? This is how the code looked like in AS2
ActionScript Code:
public function load(csvPath:String): void {
// Use the LoadVars class to load in the CSV file as a String
var csvLoad:LoadVars = new LoadVars();
[code]...
I have managed to develop code that will run a php script by passing a variable (obtained from a combobox control) to the MySQL database. Initially this works fine but if I try to repeat the excercise using a different value nothing happens.[code]...
View 4 RepliesI have read a little bit about loadVars and loadVariables, so I am trying to read and write to a .txt on my server. This is my functions: (only Read works, but Send doesn't)
ActionScript Code:
function Load(F, VAR) {
var DATA:LoadVars = new LoadVars();[code]...........
There are no errors or something; but the file is the same after Send();
When I was working with a txt file locally I used this command
file = new LoadVars();
fileURL = "PhoneBook.txt";
file.load(fileURL);
[code].....
I try to get a variable from php : I have a button with :
on (release) {
$myLoadVars = new LoadVars();
$myLoadVars_received = new LoadVars();
$myLoadVars.var_to_php = myComboBox.getSelectedItem().label;
$myLoadVars.sendAndLoad ( "script.php",$myLoadVars_received);
$affich_var = $envelope_received.var_from_php; }
PHP //
script.php :
<? $result = mysql_query( "select counter from data_base where data1='".$_POST['var_to_php']."'");
$counter = mysql_fetch_row($result);
echo ("&var_from_php=$counter[0]");
?>
My result of all this : nothing happens. no variable is received from php. (The is no request ( from the firewall ) from flash to access the internet). So I think the error is around the sendandload. By the way, the php script works perfectly with loadVariablesNum.
Okay, so ive loaded some data from PHP into a textbox in Flash with loadVariables, but then found out, that loadVariables, havent got a way of checking if everythings loaded. So im gonna use LoadVars instead,This is the old loadVariables code:
Code:
on(rollOver){
loadVariables("document.php", _parent, "POST");
[code].....
Just wondering if you can use the sendAndLoad method of the Loadvars object to send "POST" data to a server then recieve the response in an XML object.
[Code]...
I am using the loadVars class (Flash 8) to load key/value pairs from a mySQL database through php (example &pic1=pic1.jpg&pic2=pic2.jpg&...).
The ultimate goal is to create a dynamic slideshow with a variable length, depending on how many pics were submitted by the user. Since the associative array object returned by loadVars does not share the "length" property of indexed arrays, my guess is that the values need to be converted into a new indexed array before being able to use them in the slideshow.
This should be a rather simple thing to do. Server is running, files are in my htdocs folder. but it just reports undefined.
Code:
var cat = new LoadVars
function printOut(success){
frankencat.text = cat.id;
}
cat.load("test.php");
cat.onLoad = printOut();
PHP Code:
<?php print "id=lalalalalalalalalalallalalalalalalalalalalalalalalalalala";?>
I have a project that needs to store user input on the server, then be able to reload it later.I am interested in opinions as to which separator would be best to use, ie comma, semicolon, tilde, etc. Of course whichever character it is, it will be restricted from usage by the user, so it must be uncommon.I'm leaning towards using the tilde, since I already use input textfield restrictions to prevent backticks for server security (same key on the keyboard). Seems to me as if the tilde is a very rarely used character, and so should be fine to exclude it from user inputs as well.
View 1 Repliesi'm currently trying to make a "create you're own guy" type thing, i dont have any clothes right now i just have skin colour and eyes, but it works on frames, like if you have frame 1 of eyes you'll have asian looking eyes. etc.
my problem is that, it only loads the first variable from my php doccument, ive tested everything, and all, switching up my 2 variables, and when EYES comes first in the doccument only eyes load, and when SKIN comes first in the php doc only skin loads...
but anyways heres my code.
Code:
Var = new LoadVars();
Var.load("http://THISISMYSITE.com/site/phptest.php");
eyes.onEnterFrame = function() {
[Code]....
I need to load an image and 2 dynamic text fields tied to the TWEEN CLASSand controlling the SWF file via HTML ONLY - no PHP or external .TXT fileI want to change info in HTML code to change content of the SWF filecan this be done?
View 2 RepliesI am attempting to post 3 variables to an e-commerce page that was written in ASP.NET 2.0, but it is not working. I have deployed a simple .aspx page that echos the Request.Form object to the page so that I can see what it is receiving.When flash calls the loadvars.send() in Firefox I see what I would expect which is a list of keys value pairs.
View 1 Repliesso ive just been fiddling with a loadVars to load in some html text, into my dynamic text box, with render as html button tagged. it only loads in a certain amount of my text file (which is a .txt -- and my fonts have been embedded)./.
Code:
var textData:LoadVars = new LoadVars();
textData.onLoad = function()
{
[Code].....
And yeah, it just doesnt load in all the wonderful text I have written.
I wonder if this is doable. Let say if I have an object:
var car:Object = new Object();
car.color = 'red';
car.doors = ' 4';
car.make = 'Honda';
car.model = 'Accord';
Can I send this object via Loadvars like this:
var send_lv:LoadVars = new LoadVars();send_lv.carobj = car;
send_lv.sendAndLoad("script goes here", result_lv, "POST");
As the title says I am loading a flash in my webpage and when I call LoadVars() it crashes the web page.Here is my code:
Flash
lv = new LoadVars();
lv.onLoad = onLoadCallBack;
[code]........
I'm using loadVars to load a PHP URL with lots of sensitive information required for the Flash application.Only problem is that URL can be accessed via a web browser which raises security issues if someone gets a hold of this URL. Is it possible to have the PHP page only accessible via my Flash application?
View 3 RepliesI have a flash front end that displays information and is capable of building MySQL queries and handing them off to PHP via loadVars. PHP handles the dirty work of connecting to the database, executing the queries, and returning any results. So my problem is with single quotes. In flash I can build the query string with single quotes easy enough, but for some reason php keeps doubling them up and messing up the query.
Here is an example of the flash code:
ActionScript Code:
var send_lv:LoadVars = new LoadVars();
var load_lv:LoadVars = new LoadVars();
load_lv.onLoad = function(bSuccess){
if(bSuccess){
trace(this.output);
[Code] .....
The problem is that the sql statement that php is trying to execute looks like this:
insert into mytable (field1, field2) values (''value1'', ''value2'')
Where each single quote has been turned into two single quotes for some reason.
I'm experimenting with loading an array of elements into my Flash project using the LoadVars property (I'm using Flash 8 - AS 2) The elements are queried from MySQL using PHP to a page named "elements.php" and loaded into the Flash file. It works fine, but I'd like to be able to protect the "elements.php" page so that the variables queried from this page cannot be viewed by someone who types the absolute path to the elements.php file in the browser address bar [[URL]. Using includes, I'm able to protect other pages in my site from direct assess but these methods don't seem to work when the URL is called from within my SWF file.
My fear is that someone might decompile the swf to reveal the LoadVars URL present in the actionscript. I know there are ways to obfuscate the code, but I'm not sure how well these methods really work. I also understand it is practically impossible to completely hide the code from someone who is REALLY intent on getting it, but I'd like to make it as difficult as possible.
I am using loadVars to get strings from a text file and then I loop it to put them all in an array. But as indicated in the code, I want to check the variable name so a certain named variable will be put into a different variable, not the array. I have not been able to find how to check this...everything I try gives me undefined.
ActionScript Code:
myVars.onLoad = function(success) {
if (success) {
[code].....
I am trying to make a simple POST using LoadVars. Since I am using an API there are some limitations though. The request must be send via POST with a JSON header. The body of the request should not contain name value pairs, but rather just a JSON object.
This last requirement has been troublesome for me because it seems like the only way to make a POST with LoadVars requires you to specify a variable name.
[Code]...
Can I bring in a variable (saved in a text file) using LoadVars and then make that variable accessible from anywhere in the script (i.e. make the variable a global)?
View 1 RepliesMy AS2 flash file is loading in preferences from a .txt file. Is it possible to redefine the stage of the swf with this method? In other words, if someone wanted a swf with different dimensions is it possible to load those in via a txt file and resize dynamically instead of having to re-publish the swf with the new dimensions?
View 3 Replies