AS3 :: Flash - Return A Value From A Function?
Aug 21, 2010
I am trying to have the function toggleClick return powerData. I need to store powerData in a variable and have it passed to another function to do calculations.
Inside the function toggleClick, I am assigning powerData to houseArray[e.currentTarget.name.toLowerCase()];
var powerData:int = houseArray[e.currentTarget.name.toLowerCase()];
I tried just to write return powerData--but it breaks the program.
// function toggleClick
function toggleClick(e:MouseEvent) {
// Store "Power" Values of House Objects in Array
[code].....
View 1 Replies
Similar Posts:
Jul 21, 2011
I have one function "Login" and function "_urlSended" inside of function "Login". So i want that sub function returned value as a parent function. I just want that script to work
<![CDATA[
function onButton1click():void {
Label1.text = Login('irakli', 'password1');
[Code].....
View 2 Replies
Jul 20, 2010
I feel like this should be correct but the trace always returns 'undefined'
PHP Code:
function loadXML(xmlFile:String):XML{ var xmlLoader:URLLoader = new URLLoader(); var xmlData = new XML(xmlLoader.load(new URLRequest(xmlFile))); return xmlData;}var xmlData:XML = loadXML("xml/nav.xml"); trace(xmlData.link.image.text() [0]);
[Code].....
View 5 Replies
Dec 2, 2010
I'm developing an AIR app that requires a menu to show only during the first run. In it the user will be able to choose the desired language for the app to run in.
I'm displaying this menu without a problem but I need it to stay visible until the "select language" comboBox is changed and then return the selected choice's data value.
how to return a value only after the combo box is changed.
function promptFRMenu():String{
FRMenu.enabled = FRMenu.visible = true; //when I detect the app is running for the
// first time, the dialog box is enabled
[Code]....
View 2 Replies
Feb 17, 2012
I'm just trying to make a simple function that will return all the data from my SQLITE database as an array. But it looks like when my function is returning the array, the SQL statement is actually still executing... so it's empty... Does anyone have a suggestion? Or am I just going about this whole thing wrong.I know I could just have the event listener functions outside this function, and they could then set the data. But i'm trying to make a AS3 Class that holds all my SQL functions, and It would be nice to have everything for this particular function just in one function, so it can return an array to me.
public function getFavsGamesArray():Array
{
getFavsArraySql.addEventListener(SQLEvent.RESULT, res);
[code].....
View 2 Replies
Aug 4, 2009
I'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):
[Code].....
View 3 Replies
Aug 4, 2010
I'm using an AMF service that was built by someone else. Basically what happens is that some info is passed to the AMF service and it returns true or false.I want to be able to pass in various info to the a function that calls the AMF service(submitTracking) and then get the true or false value returned in onResultSubmit to be passed back to submitTracking.
var screen:String;
var buttonnumber:String;
function submitTracking(screen:String, buttonnumber:String) {
[code]....
View 3 Replies
Mar 29, 2010
Anyway, I have a function that goes through an XML file, looking for a specific value. If it finds it, it should return the node that contains that value. However, I'm having trouble with the whole return part of it.My code is:
Code:
thisExpando.onRelease = function() {
trace("is this me? " + this._name);
[code].....
View 2 Replies
Nov 19, 2009
I'm communicating to these movie clips with another program via binary sockets.For the first set of movie clips: when it recieves its instance name, and a second number (InstanceName+#) from the socket, the named movie clip will jump to the frame corresponding with that number. for ex:if the incoming data from the socket is (mc7+3), then movieclip 7 will jump to frame 3.
For the second set of movie clips: when it recieves its instance name, and a second number (InstanceName+#) from the socket, the named movie clip will move location across the screen, by the y coordinate moving to the # given by the socket...thats a little confusing. for ex: if the incoming data from the socket is (mc4+500), then movieclip 4 will move so that it's y coordinate is at 500.[code]...
View 2 Replies
Jul 21, 2010
After reading about classes, package, namespace and classpath till not able to understand what is the best way to write classes....
Here I am facing problem with this error can you tell me what mistake I am doing here.[code]...
View 7 Replies
Jan 29, 2009
How can I return a value from within a timer function? This doesn't work:
if (timeOneSec()) {
doSomething ();
}
[Code]...
View 1 Replies
Dec 15, 2008
I have several buttons calling the bounceOut() function andthe bounceOut() function calls the onMotionFinish() function. Afterthat function is finished I want to go back to the original callingFirst a call is made to bounceOut() when a button is clicked.I have ten buttons.
function bounceOut() {
var smSlide:Tween=new
Tween(sideMenu_mc,"x",Regular.easeOut,200,-200,2,true);
[code].....
View 2 Replies
Sep 26, 2008
there is an interesting problem here:
How to return a value from a function to public?
Here is the code:
var df:String; //i declared it here
function onResult(e :OperationEvent):void
{
df = e.data.toString(); // i set it here
[Code]...
View 5 Replies
Jan 24, 2011
How do make a function return *, by star, I mean the function is able to return anything, and then I can typecast it accordingly?
[Code]...
View 3 Replies
Jun 3, 2011
I basically have a class which loads a set of MovieClip objects and provides accessor functions to return them.[code]Obviously this doesn't work, but it gives an idea of what I'm trying to do. I want to return a MovieClip to the calling code only if the object has been loaded.
View 2 Replies
Oct 25, 2011
It doesn't appear to be possible to get the return type of a function. Is this correct?
View 1 Replies
Jan 3, 2009
I've run into a bit of a snag on this slideshow I'm trying to create. My plan involves adding movie clips from the library by attaching them to an empty movieClip. Then using setInterval and a variable as a counter, it increments in the function. When the number reaches "20" the first movieclip is removed and the next one is displayed. Here is my code:
ActionScript Code:
createEmptyMovieClip("canvas_mc", 1);
canvas_mc._x = 75;[code]....
//How do you bring on the second slide when the first is removed? So, my problem is that I'm thinking that the return value from my function should be 20 but instead I get 0 in the trace statement.My plan was if it equaled 20 to bring the next slide out from the library, thus moving forward with the slideshow.
View 9 Replies
Feb 4, 2009
In the code below - fRequest_activate initiates a sendAndLoad - all fine and dandy. Thing is - I want to be able to return a value from this function that indicates whether the server response was satisfactory - and I can't work out how to to it.Because the onLoad function is nested within my fRequest_activate function it has all got a bit messy - and just doesn't work - how do I pass the status from an asynchronous server call - which at the moment is picked up by the onLoad callback, back to my original function? - or should I just approach this problem in a different way? All I want to do is call one function - and know if it has been successful or not in talking to my server.
Code:
function fRequest_activate():String {
var lvEmail_send:LoadVars = new LoadVars();
var lvEmail_response:LoadVars = new LoadVars();[code]...............
View 5 Replies
Sep 17, 2009
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]...
View 2 Replies
Oct 19, 2005
I was just curious if you HAVE to assign the return value of a function to something in order to preform operations on it.
Code:
something.getClip().onRelease = function() {
//
}
Thats probably illegal right? It's illegal in C++, but theres usually a way to get around it like.. (getFocusClip()).onRelease. Or should I just forget it and do it the right way:
Code:
var tempClip:MovieClip = something.getClip();
tempClip.onRelease = function() {
//
}
View 4 Replies
Mar 21, 2007
Ok, I have a function that creates a button, it takes the paramaters
bX, bY, bcColor, bbColor, bHeight, bWidth, bHandle;
here is my function
Code:
function createButton(bX:Number, bY:Number, bcColor:Number, bbColor:Number, bHeight:Number, bWidth:Number, bHandle:MovieClip)
{
[Code]....
some reason when I try to hide Handle, it doesn't do it, & trace's dont do anything either it is suppost to create the button & store it in any handle I give it
View 3 Replies
Apr 17, 2007
The title of this post may not make much sense, let me explain. I have a function:
findSurface(origin:Point, vector:Point, attempts:Number):Point The function has an obscure use, but the idea is thus: given those three arguments, returns a point IF the 'line' (created by the origin and vector arguments) intersects the object the function is called on. [but that is another story...]
More importantly, if there is no point of intersection at all, what should the function return? Void? Null? Undefined? Object? Or can I use one of those return types instead of Point incase the function does not encounter an intersection?
View 6 Replies
Apr 17, 2009
Is there a way to return URLVariables from a function
eg:
function varsLoaded():URLVariables {
var variables:URLVariables = new URLVariables();
variables.var1 = 'string1';
[Code]....
Now what I would like to do is assign "variables" to a variable:
var theVar = varsLoaded();
trace(theVar.var1);
Obviously the code above isn't correct; just to illustrate what I'm hoping to accomplish.
View 1 Replies
May 18, 2009
I cannot for the life of me figure out how to return a value out of a ROLL_OVER function. It seems extremely easy, yet I cannot get it to work. Here is a simplified version of what I am trying to do:
test_mc.addEventListener(MouseEvent.ROLL_OVER, testOver);
function testOver(event:MouseEvent):String
{
return "hello";
}
trace(testOver());
View 3 Replies
Jun 18, 2009
I'm trying to create a function that determines which of 4 similar classes to create, and returns the new object itself.
Basically, I have a base class (Panel) that has 3 additional variations in layout, each of which has a subclass: TextPanel, FeaturePanel, and LinkPanel. The two parameters for my function are the "kind" of window to create and its name ("linkString"), both of which are provided by external XML. I'm wondering if it's even possible to return the new Panel as an object...?
My code will probably explain this better than I can:
Code:
// create the new Panel variable ("addPanel") with a call to newPanel:
var addPanel = newPanel(linkList[i].attribute("kind"), linkString);
Code:
// newPanel function:
[Code].....
within the Panel constructor, the provided string (linkString / 'h') is set as the Panel's .name. I did not copy that function into the subclasses, since they inherit it - unless I'm mistaken.
View 8 Replies
Dec 14, 2011
i have my main function:
function main(){
call_xml("myxml.xml");
trace(data)// NULL
[code].....
so, i want to get my data XML var back to main, i get NULL (i think is oncomplete fault )
View 12 Replies
Mar 30, 2010
I'm working with timeline actionscript. I want to create a function that loads my xmlfile and returns an xmlobject with the file's content.[code]...
View 7 Replies
Jul 21, 2011
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);}
View 3 Replies
Aug 16, 2011
I am trying to move text movies and textfields around a stage. This is a learning curve for me. I am confused by an example I have found on the internet.
[Code]...
View 6 Replies
Mar 6, 2011
I'm trying to do here, basically I need to check if a record exists in a database, so I call a function to do so, but I'm using the sqlrunner class wherein the result of a query is called as an event response and I don't know how to get that value out of the resulting function back to the parent.[code]...
View 1 Replies