ActionScript 3.0 :: Losing Variable Values Between Functions?
Nov 9, 2009
I'm trying to do something simple in actionscript as simple as this:- Create a variable: var urlVideo:String;- Use that variable inside a function and give it a value: urlVideo = ideoElemento.url.text();- Then create a new variable and give it the urlVideo value: var url:String = urlVideo;
Here's my code:
var idVideo:String = "12";
var urlVideo:String;
[code]....
View 14 Replies
Similar Posts:
Oct 16, 2009
How do you pass variable values between functions where the addEventListener is in the first function? I am trying to get the color value passed into my event handler. [code]...
View 6 Replies
Aug 12, 2010
recently tried developing an flash application that would send info to php and php should read a browser cookie and pass back the cookie value as e.g myCookie = $myCookie, where:
$myCookie = $_COOKIE['test'];
Funny enough in Actionscript myCookie is read as blank but the other variables that are hard coded are showing. what could be the problem PLEASE HELP I desperately need the solution. My Code is given below:
PHP Code:
[U]file next.php[/U]
<?php
$myCookie = $_COOKIE['test'];
[code]....
View 2 Replies
Dec 2, 2004
in this example why the values of (12) and (21,39) are lost at the geo and geo1 functions
[code]...
View 11 Replies
Jul 26, 2010
I followed a dynamic gallery scrolling thumbs tutorial and then changed it quite a bit to fit my needs.
I basically added a previous and next button and image title box.
It all works great apart from one thing.
e.g. I click on thumb 5. I then use the next button and go to say... image15. I then click on thumb 9. When I use the prev or next button again it will resume from image15, but it should then carry on from thumb 9 as that was the last change I made.
I thought this would be as simple as assigning the thumb variable value to the image number variable. i.e myID = id; but it doesn't work. my variable myID actually loses its value when I click the thumb image (I used the trace to clarify).
Here is the code.
PHP Code:
function bttnClick(event:MouseEvent):void{
bttn.gotoAndStop(1);
root.logo.visible = false;
myID = id;
[Code].....
View 4 Replies
Nov 4, 2009
I've hit a very strange issue in adobe flex and I'm not sure how to solve it. I have a popup box that is called on creationComplete before startup of my main application. The popup simply asks for an email address and then the application is enabled showing the email address in a label component.
However, when I try to access the email address from the label component called UserID.text in the application, it is always null even though it is visually present in the label box...It seems like it loses state somehow...so HOW in earth can I keep it from losing state? I need to access the label or some variable throughout the use of the application and everything I try always ends up in a null variable?The main part of the application that sets the label is here:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:controls="com.iwobanas.controls.*" xmlns:local="*" creationComplete="showWindow(true)">
private function showWindow(modal:Boolean):void
[code]....
View 1 Replies
Apr 19, 2004
I have a function that I want to get an array out of. Do I just return the array to the function, and when I call the function set it equal to a variable?
View 1 Replies
Jul 2, 2009
is there any way to locally define a variable in a function and then pass it to the oher function. I mean to say is it possible the pass a local value from one function to other function.
View 3 Replies
Sep 11, 2005
For example:
myFunc = function (p1, p2) {}
Or:
myFunc = function (ab) {}
[code].....
View 3 Replies
Feb 11, 2012
I currently have a basic application where we have multiple buttons, which have functions activated by "click" event listeners on those buttons. The issue is that each button does more or less the same function; just the data that is loaded for each button is different. How do I make it so I'm able to recycle the same function? In Javascript or AS3 something along these lines would be done...
<s:Button id="btn_1" x="378" y="601" label="Button 1" click="photoSwap(event,"image1.jpg")"/>
<s:Button id="btn_2" x="350" y="601" label="Button 2"
[Code].....
But that's obviously not how it works. I've tried trouble shooting the issue but haven't been able to find anything. It works when I have each button having its own function, but that seems really silly and shouldn't need to be done.
View 1 Replies
Jun 3, 2011
I have a main mxml and 2 AS classes.In the main mxml I have a slider.I want to get the slider values in AS classes as I move the slider.
Main.MXML
import First;
import Second;
[Code]...
I could get the values from trace(dat)....I mean the date's as the slider changes. How could I use this changing values in function visualization()
View 1 Replies
Nov 18, 2009
I have just started learning AS3 (2-3 weeks) and I have to say its very enjoyable!I am trying to make a function that pulls in values to save me writing 15 separate functions!I have a "street mc" which has 15 "house mc's" inside.When the user hovers over a house I want the resident to appear above the house.The house instance name is house1 and there is a mc in the library linked using the MrsRoy() class.This is my code so far:
Code:
var house1Res:MovieClip = new MrsRoy();
function resIconIn(e:MouseEvent):void{
var currentHouse = "street." + e.target.name;
var currentRes = e.target.name + "Res";
[code]....
I get the error:
TypeError: Error #1006: value is not a function.
at Dignity_drive_fla::MainTimeline/resIconIn()
View 1 Replies
Aug 30, 2005
Is it possible?!Here is an example:
for (var i:Number = 1; i<nTest; i++) {
var test + i..
}
[code].....
View 1 Replies
Feb 23, 2010
I have a function that includes a variable which I need to use in a different function after some effects occur.
View 6 Replies
Mar 2, 2009
I am trying get a timer function that I can change the interval on? IE. I invoke the function for 5 frames and the last one I want to have a different delay time. It seems that for each action I have to create multiple listeners and multiple functions for? Surely there is a way, without producing a class, that I can just chaneg the timedelay? But, AS3 wants to declare the time before the function.
View 2 Replies
Nov 10, 2010
I want to be able to set variable tween parameters, but I know its not always good to set variables within functions. For example:
function clickHandler(MouseEvent){
var myTween:Tween = new Tween(object, "width", Strong.EaseOut, 1, variableWidth, 1, true);
myTween.start();
}
Is this the only way to do it, or can I change myTween parameters within the function without declaring a new tween each time?
View 6 Replies
Aug 6, 2003
I don't know why the value of my variable my_str is undefined outside of this function:
loadText = new loadVars();
loadText.load("data.txt");
loadText.onLoad = function(success) {
[Code]....
ps: I tried making my_str a global function or even defining it as _root.my_str but I always get the same result..it's undefined outside the function...I need that value for something else so...
View 1 Replies
Oct 30, 2004
I need to create a table and i need to be able to add data and change the data automatically using values computed by other functions. I was trying to use arrays to create the rows of the table but i dont know how to individually name each array. The arrays have to created automatically and so i cannot name each array manually.[code]but the value for the array is undefined.
View 1 Replies
Jun 15, 2009
I am desperate about this.[code]...
Another thing: how to access array values from outside of function?
View 2 Replies
May 7, 2009
This one is tripping me up. I'm creating a simple 10 question 'quiz' with simple "yes" or "no" radio buttons for each question. If they picked "yes" the value is 5, while "no" is 0. I want them to be able to choose all of the answers and then click submit. On submit it would add up all the answers and save that number as a variable named "score".
I know how to setup all of the radio button groups, calling each group question1, question2, question3 etc and giving the values to each yes and no radio button. I just don't know how to capture the values on submit, add them up and save to a variable.
View 1 Replies
Oct 17, 2009
I just started working with CS4 / as3 and I'm working on extracting simple text from an xml file. I got the code off youtube, and it seems that even after copying this guys code line for line, it doesnt work. More speficially, the trace/output doesnt want to output variables. I did use trace("hello") and that worked fine, so its not the omit output option, but it just wont display the values from variables.[code]...
View 5 Replies
Sep 29, 2004
Is it possible to get values for a variable from an array.How would i do this?
View 2 Replies
Feb 16, 2009
I sometimes have to test if a specific part of code is executed, and i just write
Code:
trace("ok");
Do you trace some more useful message instead ?
ps. I'm not talking about tracing variable values.
View 1 Replies
Jun 17, 2011
i'm trying to add values to a variable.[code]a simple drag and drop on a MC.i would like to store the X displacement when i drag. let say i have 30 in a variable wich store x position of myMC, if i drag the MC 200 units the variable should read 230 and so on.
View 2 Replies
Sep 21, 2010
just a quickie - im sure this is possible but for some reason its not working, - can you put variables within javascript calls, ie
getURL("javascript:swffit.fit('my_flash',1024,(700 +_root.imageHeight));");
where _root.imageHeight is a variable within flash
anyone know where i may be going wrong?
View 2 Replies
Apr 1, 2009
I want to know how to use a string variable as the URL in a Movie Clip event.
sample code:
var numCount:Number = 1;
var strMov:String = "rock" + numCount;
bob.removeMovieClip(strMov);
View 5 Replies
Oct 21, 2009
I'm trying to repeat a function that basically will attachmovie on a "tileset", an image depending on the parameter. It's called AddID(i), and currently there's only 2 valid options, 0 and 1, images showing, X and O. There's a Button, and theres an array and a function that shows an image of the tile depending on its ID value loaded from the array.
My problem is: Everything works just great as if you repeat the function by clicking again, but... When repeating the function by code, all the tiles will have the Image of the last tile added.
[Code]...
View 4 Replies
May 2, 2010
if defining variable types in function parameters gives any speed boost.
e.g
ActionScript Code:
function DoIt(param1,param2,param3):void
{
[Code]....
is there any performance difference between above functions. in theory compiler should be able to manage memory more efficiently when knowing what data to expect, but is it so in flash
View 3 Replies
Apr 21, 2009
Is there a way to write an "ANY" conditional statement? For example, I want to write an IF statement that if the user presses ANY of 10 specified keys, I want to execute the same bit of code.However, the only ways I know to accomplish this is by
1) writing a switch statement, which seems unwieldy because I'll have 10 separate cases which all duplicate the same [code]...
Is there a better/faster/more efficient way to check if a variable is equal to ANY of a set of values?
View 5 Replies
Mar 15, 2010
I have a query regarding assigning values to buttons in a for loop, I will explain:This is a string which I want to assign to a button value via getURL:
var myURL = "http://www.mywebsite.co.uk" + "/?Group=" + mySharedObject.data["destination"+i] + "&" + "SearchType=654&" + "Target=offers&" + "Paging=on&" + "HotelName=" + mySharedObject.data["hotel"+i];
[code].....
View 1 Replies