ActionScript 3.0 :: Returning Values From A Package?
Feb 3, 2009
I am getting variaables from a mysql database and then returning them back to the main file. However, the script is going faster than the query. is there a function that can make the file wait until it has finished loading in the variables.
Code below:
practiceIntroScreen.as
Code:
[code]....
View 2 Replies
Similar Posts:
Dec 18, 2009
I am having troubles passing an x and y argument into a package function that creates a projectile on stage at the tank.gun's x and y.I have attached a zip of the code I am working on.[code]
View 6 Replies
Feb 10, 2005
I'm trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array.
Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).
Here's the code from my timeline:
#include "functions.as"
XML.prototype.ignoreWhite = true;
var top_nav:Array = new Array();
[Code]....
how I can get needed values out of the onLoad function?
View 1 Replies
Oct 12, 2005
I need to load data from a database, so I created the following function and placed it in frame 2 on the main timeline.
Code:
getQuestionSet = function (category:String, subject:String, level:Number, count:Number):Array {
var questionSet:Array = new Array();
var writeV:LoadVars = new LoadVars();
[Code]...
Whenever I try to call the function, it fails to set the value of the questions array. It always appears empty(questions[0]-questions[10] have the value undefined). But, if I check the values from within the function after I have set them, it works, so I know that it is receiving the values. What am I doing wrong?
Code:
questions = getQuestionSet("Art and Music", "Art", 1, 10);
Here is an example of how I have would call the function.
View 7 Replies
Feb 10, 2005
I'm trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array. Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).
Here's the code from my timeline:
#include "functions.as"
XML.prototype.ignoreWhite = true;
var top_nav:Array = new Array();
var my_xml:XML = new XML();
var xml_url:String = "nav/top_nav.xml";
[Code] .....
How I can get needed values out of the onLoad function?
View 1 Replies
Feb 20, 2011
I'm running some script using the charAt() function, that is supposed to return the character at specific indexes in a string, however for some reason it is returning ASCII values.
View 2 Replies
Feb 24, 2012
I have a project made in flex, using php data services to access a sql server database, and I need to convert it to mysql, I have changed all my php services from sqlsrv to mysqli. Something like this:
$this->connection = mysqli_connect(SERVER,USERNAME,PASSWORD,DATABASE); // Start Connection
$ssqlstring = "select * from Users";
$runssql = mysqli_query($this->connection, $ssqlstring);
while($user = mysqli_fetch_array($runssql)) {
$users[$user["ID"]] = $user;
} return $users;
It worked fine on sqlsrv but with mysqli it returns to flex the INT, BIT or DATE values as string the main Datatypes on mysql are INT,VARCHAR,BIT(1),DATETIME,DATE (same as sqlsrv)
and on the flex the return types are mainly as object[]
View 1 Replies
Jun 9, 2010
Let's start with the following XML:
Code:
<swatches>
<swatch>
<swatchName>Plaid</swatchName>
<swatchColors>
<color>black</color>
[Code] .....
I want to return a list of the <color> values without having any duplicates.
View 2 Replies
Jul 15, 2009
I'm making an activity that involves measuring the depth of a fictitious river at various points. I have an array containing those depths at the various points and a slider for traversing through the depths and outputting to a textfield.
As the user moves the slider up and down, they can see the depth of the river at that point and plot it onto a graph. What I would like to do is be able to figure out the depths inbetween the explicitly defined values.
here is the code, it's pretty simple:
[Code].....
How would I go about figuring out the values inbetween?
View 2 Replies
Apr 12, 2010
In C you can pass a reference to a data item as a parameter to a function. then within the function you can write to that address thus passing back a value to the caller. Can you do anything similar in AS3?
I know you can use the return statement but I want to return a status by that mechanism plus a value in a parameter.
View 10 Replies
Jun 5, 2011
I am developing in Flash Builder 4.5 using as3.
I have created a class to connect, write and read to a TCP Socket using 'import flash.net.Socket;'
Within this class is an event listener which reads the incomming data:
Code:
socket.addEventListener(ProgressEvent.SOCKET_DATA, readSocketData);
private function readSocketData(progressEvent:ProgressEvent):void {var response:String = socket.readUTFBytes(socket.bytesAvailable);
trace response;}
My problem is how to output this data back to my main application. Ultimately I want to process the data and output it in a text box.
View 4 Replies
May 26, 2010
I am trying to connect to an FMS application without flash (no SWF). To the best of my knowledge,the only way to accomplish this is thru the admin APIs, is that correct? If so, how do I return meaningful values from the admin API? I can call functions and stuff using the broadcastMsg API call but I can't seem to get back any values. All that is returned is a useless "Success" type message. I have tried using shared objects and the getSharedObjects API call, but the call doesn't return any info on the contents of the shared objects, just their names and some info on their persistance.
Is there another way of accomplishing my goal outside of the Admin API? If not how do I return meaningful variables from the Admin API? Is there a way to hack or extend the admin API?
View 2 Replies
Jan 27, 2010
I'm running into this weird thing with ASDoc. It will only document one package function per package.For example.I have these two functions:
gs.util.printf
gs.util.ftrace
In these files:
gs/util/printf.as
gs/util/ftrace.as
The only function that get's documented in ASDocs is "printf". But I know it can do more than one. As an example, in the livedocs [URL] There are more than one functions documented.
View 2 Replies
Dec 19, 2011
I have an actionscript file,it has a package name,it locate C:demo directory,like follows:
package demo{
import flash.display.*;
public class ABC extends Sprite{[code]............
Then I compile above code like following command,but it raise following error:
C:>mxmlc demoABC.as
Loading configuration file C:sdkframeworksflex-config.xml
C:demoABC.as: Error: A file found in a source-path must have the same package structure '', as the definition's package, 'demo'.Where is wrong above command?
View 1 Replies
Oct 13, 2009
This is with Flexbuilder 3.2, Eclipse 3.3.2.I am moving my development environment to a new machine. Actionscript classes that compiled in the old environment now get a compile error:
A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.I do declare the package in these classes - I think failure to declare the package is the usual reason for this error.To add to the mystery, many classes in this project compile without errors.
View 1 Replies
Dec 14, 2004
I have classes witch resides in this package :com.network.interface_as. When I try to load one class from that package in another class in the same package like this:
[Code]...
View 2 Replies
Dec 6, 2010
I've gotten these sliders to work but can't get the output values to add up. For instance, depending on the values for slider 1, 2 and 3, I need the total to show up in a separate text box. I keep getting a NaN message in the text box.Here's the code I have so far:
//item 1
sliderOne.width = 600;
sliderOne.value = 0;[code].....
View 3 Replies
May 19, 2010
In as 2.0 there was a simple code like trace(_root._url) that would return the url of the actual swf file. What is the equivalent in AS3? The samples I found were all realted to window.location and other things, is there no simple code for this like in as 2?
View 3 Replies
Jul 4, 2011
I am trying to transfer a movie-clip staged in a swf(on local machine) to a remote server. Below is a part of the action-script code concerned with it;
function createJPG(mc:MovieClip, n:Number, fileName:String) {
trace("sdf:");
var jpgSource:BitmapData = new BitmapData(mc.width,mc.height);
jpgSource.draw(mc);
[Code]....
I want to close the swf when the upload is complete., I would like to know how to return a value(may be a number which I intend to use to indicate completion of file transfer) from the php script to the swf and how to receive that value in the swf?
View 2 Replies
Jul 14, 2009
ActionScript Code:
var temp = 1
function change(out){
out = 2
return "something"
[code]....
(I would do this if I had a function that returned a value already and I needed it to output more information - I'd pass it an output variable which it would fill for me)but in AS3 that doesn't seem to work - it seems changes I make to a function argument apply only within the function.
View 7 Replies
Apr 6, 2010
I have an external function that needs to return a customerID value. However, it seems to be returning the initial value instead of the value that I believe is being set within the function.[code]
View 2 Replies
May 5, 2011
only issue i'm having is that if i drop the item in the zone requiring a change, and pick the item back up, it combines the shapes. I'm thinking I need to have the if statement more universal. I've uploaded my fla to rapid,I'll put my coding below as well.
backbutton.addEventListener(MouseEvent.CLICK, backclick);
helpbutton.addEventListener(MouseEvent.CLICK, helpclick);
answerbutton.addEventListener(MouseEvent.CLICK, answerclick);
[code].....
View 4 Replies
Oct 31, 2009
I am trying to save settings to an XML File and setting the relevant data if the check box is checked or not.
private static function createXMLData():void
{
prefsXML = <preferences/>;
prefsXML.application.@windowsstart =
[Code]....
well i assume that is what the error means, it cannot get details of something that is not set yet.. so how would i get it to check and if nothing then it is obviously a "false".
View 5 Replies
Mar 19, 2010
When using flash remoting with amfphp, what can I write in php that will trigger the 'status' method that I set up in my Responder in Flash? Or more generally, how can I determine if the service call has failed? The ideal solution for me would be to throw some exception in php serverside, and catch that exception in flash clientside... How do other people handle server errors with flash remoting?
[Code]...
View 1 Replies
Jan 22, 2009
The following snippit:
// FLV Completion
ns.onStatus = function(info){
if(info.code == "Netstream.Play.Stop"){
[code]....
Is not returning anything at the end of my flv. I have also tried: Netstream.Play.Complete to no avail.
View 1 Replies
Mar 7, 2010
I am makign something which generates a random number, then proceeds to check it against a range of fields loaded from an XML file. I have checked and the fields are loading the correct numbers in, but the "if" statement is always returning 'true'. The only time I have been able to get it to properly execute is when I use numbers instead of variables. I have tried using Number(variable), but that doesn't seem to fix anything. here is my code.
ActionScript Code:
on (release) {
_root.colnum = Math.round(Math.random()*100);
if ((_root.colnum<=_root.wballmax) && (_root.colnum>=_root.wballmin)) {
[Code]....
View 5 Replies
Jan 14, 2009
I have a setter and getter method , the getter method should return an array collection but it's always returning an empty array collection even when I've run trace to check on it.[code]...
View 1 Replies
Jan 22, 2009
The following snippit...
ns.onStatus = function(info){
trace("The movie has ended keptain!");
if(info.code == "Netstream.Play.Stop"){
[code].....
View 2 Replies
Sep 10, 2004
i have a MC, that contains a button, and when i press that button i need it to send the instance name of _parent.MC (instance name is "kala") to the variable "_root.eelmine".result must be: _root.eelmine = kala;
View 2 Replies
Nov 2, 2005
well I have a function in my index.swf that goes like this
Code:
function getLanguage(language):String {
var sLang:String = language;
[Code].....
View 5 Replies