ActionScript 3.0 :: Return Variables After External Load?
Aug 14, 2009I have a class to load some XML and build the data into an array but I can't get the timeline to see the array. [code]...
View 4 RepliesI have a class to load some XML and build the data into an array but I can't get the timeline to see the array. [code]...
View 4 RepliesI'm using a class that I converted from AS2 to AS3 using Patrick Mineault's converter: [URL]
The original AS2 class:
Code:
/**
* Colour handling routines
* Culled from many places:
* - http://www.actionscript.org/forums/s...d.php3?t=15155
[Code]....
Is the AS2 to AS3 conversion part of the problem (aside from my ignorance of how to use it)?
how can i load variables from an external txt file?? for example: i have a txt with this values: 123 234 321 how can i load 123 and assign it to a variable??
View 1 RepliesI'm trying to use the following piece of code to load variables from an external URL into my flash. It works on one server (development server) but not on my production server. I was just wondering if there's anything to do with server setup that would cause it to fail?
Code:
this.params_lv = new LoadVars();
var owner:form1 = this;
this.params_lv.onLoad = function (success:Boolean) {
[Code]....
This exact code works on one server and doesn't on another. On the one that it doesn't work on it always hits the alert('Error: Cannot connect to server'); ..
I had a question about loading external variables. Is it possible to load external variables from a different server other than the one that the flash site is hosted on?
And if so, what would that command look like?
For instance, if you load a variable from the site's own server it might look like this;
loadText.load("TEXT1.txt");
Would loading it from a different server look something like this;
loadText.load("http://www.kirupaforum.com/TEXT1.txt");
I'm using the following code to load some variables that contain links to images. I also would like to have a second file with variables with the settings for my flashmovie. How can I use this code to load 2 files? Or do I have to nest them etc?
Code:
var imageVars:LoadVars = new LoadVars();
imageVars.load("images.txt");
imageVars.onLoad = function(success:Boolean) {
//do stuff here with loaded variables
}
This is for mx 2004. How to load variables from an external txt file at the beginning of flash movie...At various keyframes in the scene the movie shows different forms for user to fill in into the TextInput components. As soon as these forms are shown, the TextInput components are pre-filled with default text (the variable values that were loaded, for example "Enter your title here"). I know how to do this in earlier versions easily with the Var variable but now I'm stuck. I've been trying to do something but I keep getting "undefined" in the TextInput.
View 1 RepliesI've got 3 variables called pSize1 = 15, pSize2 = 16, pSize3 = 17. I have some radio buttons that have the data: 1, 2, 3. depending on what radio button is pressed, I need to trace the data in either pSize1, pSize2, or pSize3.if they user presses the first radio button, it returns data 1, how can I combine that with "pSize" to return 15, and not "pSize1". What i have tried so far:
Code:
var listenerObject:Object = new Object();
listenerObject.click = function(eventObj:Object):Void {
thisSize = eventObj.target.selectedRadio.data[code]......
I want to assign an existing Object all the vars of a prototype Object, without a direct reference. One way to do this is:
[Code]...
This way both Object's values for .nom and .age can be independently changed, but it's tedious. Is there an automated way to assign all of protoObject's vars to enObj?
As seen below, I tried to return more then one variable from a function but , I think I have some syntax problem..
function hesapla3(parametre1,parametre2):(Number&&Boolean) // PROBLEM IS HERE, I NEED TWO VARIABLES TO RETURN{var yenideger2:Number=new Number();var bol2:Boolean=new Boolean();yenideger2=parametre1+parametre2;if(yenideger2>80){bol2=false;}return yenideger2;return bol2;trace(yenideger2);trace(bol2);}
First of all sorry im not very familiar with the flash lingo, im still new to all this actionscript stuff
ok so i wrote this on a frame in the timeline[code]...
now i need to check which one from all these has a value of zero. then when it finds it i need it to tell me which one it is (s1x or s2x or s3x) so i can do stuff with it.
I have the maximum possible reduced cod of an xml accessing data:
Code: Select allvar myLoader:URLLoader;
var myURL:URLRequest;
var myXML:XML;
[code]....
How i could make a CORRECT RETURN of these myLoader.data possible values so i could have "in the end" some EXTERNAL variables:
var myName:String = new String()
myName == .....the result from function "readXML": ....trace(myXML.product.name[2])
or
var myNumber:Number = new Number()
myNumber == .....the result from function "readXML": ....trace(myXML.product.length())
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]
I'm new to Actionscript programming. I'm trying to figure out what is the best way to return multiple variables, each having a different data type, from a function. For example, if a function needs to return variable aa ( a string) and variable bb (a number).
The function I'm using just crunches a lot of math, and doesn't relate to an object in a GUI. One method I got from a Google search used an Object, but as (I think) this requires me to create a class, I wondered if there was a simpler way. Since an array can hold elements of different data types, perhaps this is a simpler approach (?). [code]...
I 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 RepliesI'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'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'm trying to define a variable as a function that loads a text file, like this:
ActionScript Code:nouns = loadFile( "nouns.txt" );
The problem is I can't see how to get "loadFile" function to return the value because I have to use that event listener function to tell when the load is complete, then I can't return from inside the listener function... how can this work?
[Code]...
I am trying to load variables from a text file, and have them available from then onwards in the movie, globally so to speak.
While I can read the variable values in a loader function which executes when the text file is loaded, I don't seem to be able to keep those variables available afterwards.
I have tried several suggestions on this forum to resolve my issue, but it is obvious to me I am missing something because I am a NOVICE Flash developer. I have everything working in my Flash file EXCEPT I want to use this code to play a .swf file. When the swf file is done playing OR the user clicks the return to Main Menu button¯, they return to frame 1.[code]The .swf file plays and when I click Return to the Main Menu button, only certain items display from frame 1. The .swf file is still loaded hiding the items that should display on frame 1. I have attached a screen shot of what happens when I click the "Return to Main Menu" button.
View 7 RepliesActionscript is really stressing me out! My code is too messy to post as I have tried everything from design patterns to procedural approaches. In short, is there any way i can retrieve my XML data in a variable after loading the URL request?
var req:URLRequest = new URLRequest(url);
this.loader = new URLLoader(req);
this.loader.addEventListener(Event.COMPLETE, readXML);
Basically I am trying to capture my XML output so I can place it a list. There doesn't seem to be a way to assign it to a variable without it losing scope when the event is over.
I have a SWF loaded via a "swfobject.embedSWF()"I use Javascript's methods to pass calls via the flash APIs:call.player.sendEvent('LOAD', theFile)Using a XMLHttpRequest() call via GET to a PHP script I get a file url:Typing the URL into my browser starts the file, but passing the variable to the sendEvent() call does nothing. Why?
var response = http.responseText;
loadFile(response);
player.sendEvent('PLAY');
[code]......
Im trying to set up a class which will load xml and return data I can later parse with a parser class.
When I run the getRawData function from the fla, I get [type function].
[code]...
I have just started using external AS3 files to try wean myself off using code in the main time line.I am importing an XML file using an external as3 file, but cant return the values to the main timelineIt worked when I used the trace option, but I need these values to dynamicly populate a movieclip on stage (another problem I cant add movie clip to stage even though I have the linkage etc)AS3 Code ----------------------------------
package com.teamSelection
{
import flash.display.DisplayObjectContainer;
[code].....
What is the best way to load a big load of variables into Flash? There must be a way to do this withLoadVars and a for-loop.my txt file:
Code:
&prijsvraag_titel=Title of the prijsvraag&
&aantal_vragen=3&[code].....
Structure: There is 1 main file that loads external SWF files depending on what is clicked on.One of the external SWF files loads its text from external text files. This works fine when viewing the SWF applet on its own. But when viewing as a whole site, the text doesnt appear. Very annoying.I made that particular SWF on my mums computer running Flash MX 2004The flash file itself uses the Scrollbar component from MX.Could someone tell me why the text doesnt load in this scenario? It runs fine on its own, just not as an external SWF.
View 4 RepliesI have a Flex application that just load an external SWF, but the application load and unload infinitely my swf.
[Code]...
I am trying to get a nav button in one movie (main_nav.swf) to target a my main movie (index.swf) and load a sub nav movie (metals_subnav_infinite.swf) into it. The sub nav movie will do a similar task - loading a portfolio swf into main movie (index.swf). Here is the file breakdown of my working files:index.swf - main final movie which loads "main_nav_infinite3.swf" on startmain_nav_infinite3.swf - loads main nav "main_nav.swf" and scrolls it infinitely (infinite menu)main_nav.swf - main nav with buttons that trigger sub nav "metals_subnav_infinite.swf" to load into index.swfmetals_subnav_infinite.swf - loads sub nav "metals_subnav.swf" and scrolls it infinitelymetals_subnav.swf - sub nav with buttons that trigger "folio.swf" (have not created this file yet!) to load into "index.swf"The script I was focusing on is in main_nav.fla and it is:
metals_mc_bn.onRelease = function() {
reActivateMenu();
this.gotoAndStop(3);
[code].....
- i have 3 separate movie clips (a,b,c)
- my main movie is (a) and when i click a button there, it will go to external movie (b)
- under external movie (b) there's a movie clip that includes my animation and content button
- if i click on the content button on movie (b), external movie (c) will pop up [ it will not replace movie (b) but will just overlap it, it's like a small pop up ]
i did the actionscript and when i'm testing external movie (b), it's working... it's showing/popping up movie (c) but when i tried it on the main movie (a), the movie (c) is not popping on the (b) err, sorry if it's a bit confusing / how i explained it. but hopefully somebody will get the idea. and it won't also return on the main movie (a) when i click on a link from the external movie.