Actionscript 3 :: Modify Variable From Within The Function?
Jan 30, 2011
I am being forced to work with ActionScript / Adobe Air. Coming from a Java-Background. I cannot figure out what I am doing wrong here,Basically I would like the function to return the XMLNode it fetches.
public function getXmlWebpage(address:String):XMLNode {
var service:HTTPService = new HTTPService();
var xmlResult : XMLNode = null;
[code].....
View 1 Replies
Similar Posts:
Sep 24, 2009
I've currently got this script (see below). What I'm trying to do is make it so I can load several images from a loop. I've played with a few different things, but I'm not completely understanding how the listener works as it relates to the loader. It seems when I try and add a second image, it only enters the onComplete function 1 time, therefor i only get one Image loaded. As a side note, I've also been trying to dynamically change the x and y position, but I'm not sure how to modify a global variable from within that function, or better yet, pass in the arguements during the eventListener call to onComplete.[code].....
View 2 Replies
Feb 22, 2010
Does anyone know if it is possible to have an Array containing predefined variables - then modify a variable using the array?
For example
ActionScript Code:
var data1:String = new String;
var data2:String = new String;
[Code]....
This will currently trace 111 - can I get it to trace "Hello"?
View 9 Replies
Jul 25, 2007
I've played around with it for a few days but nothing seems to work.Is there a way to modify the onRelease to include a variable?
clip.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};[code]...
I also found this somewhere on Kirupa regarding flash and lightbox but wasn't sure how to implement it:
getURL("javascript:show( ' " + w + " ' )");
View 13 Replies
Feb 20, 2009
so here is some code that works:
Code: Select allfor (var i:int=0;i<numOfItems;i++) {
item = new Item();
//etc etc
[code]....
how do I modify the mouseOverItem function so that it works. More specifically, how do I alter this line:
Code: Select allvar selecteditem:Item = Item(event.currentTarget);
so that it knows that I'm talking about item.icon and not just item?
View 1 Replies
Apr 25, 2010
I want to modify the trace function to add it to a log, then display it in the trace output window.
View 3 Replies
Jan 17, 2011
I have an actionscript function that, after modifying some values and "executing" it, it has to return some specific result, my question is:
żIs there a way to build a webpage that let users modify that function using a form and then execute it in order to get a result?
View 1 Replies
Feb 11, 2010
I'm trying to send a variable from an HTML into Flash in order to modify it based on the value. I generally know how FlashVars works in AS3, so I did some quick reading for AS2 and made a test swf.
[URL]
In my swf, the first frame only has this code:
Code:
if (_root.tester == undefined) {
var passed:String = "Nothing Passed";
} else {
var passed:String = _root.tester;
}
texty.text = passed;
According to what I've read and what my code is, this should work. It should read the value of video as the value of _root.tester (check the HTML code), yet it's always listed as undefined.
View 2 Replies
Jan 29, 2012
I have a public variable and I am trying to set it, then read it from a different function:
public var str:String;
public function DailyVerse()
{
function create() {
[Code]....
My trace results says null. Why does it not give me "hello"?
View 1 Replies
Mar 7, 2012
how you would target a function's local variable through a concatenated variable string.For example:
var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........
I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?
View 2 Replies
Jul 28, 2007
I'm trying to combine PHP/SQL and Flash. I've got a problem now. I want to load a variable that contains an url to an image. so the variable is like this: [URL] Now I want flash to load the image, not the text. The variable is called 'img1' but the loadmovie function doesn't work when I put it in.
View 2 Replies
Nov 24, 2010
I want to monitor a variable. Whenever the variable value changes I want to call a function. In actionscript 2 I can use "watch" but in as3 what can do ?
View 1 Replies
Nov 27, 2009
I have a set of Cue Points in an FLV I'm playing. It's an interactive quiz, so the idea is that flash will change a variable, theAnswer, to a different letter depending on which question it is. The answer to question 1 is B, question 2 is D, etc. Either the cue point event listener isn't working, or else it is working and Flash isn't declaring the variables. 1120: Access of undefined property theAnswer. I literally can't find a single problem with my code. I have an almost identical Event Listener further down which works.
[Code]...
View 4 Replies
Jul 27, 2009
is it possible to declare function this way
ActionScript Code:
function startShake(e:MouseEvent, num1, num2):void
what i mean is it possible to send to the function not only en event but also a variable and a second question how can i access
ActionScript Code:
function stopShake(e:MouseEvent):Array
this array that function return.
View 1 Replies
Sep 16, 2009
I need to pass a variable to a function inside a function. However this parameter (i) seems not to be passed (to function ...onRollOver). This is required to attach a textfield to a movieclip (reading the adress and showing it as a tooltip).
ActionScript Code:
for (i=0; i<array_BE_ElecCities.length; i++) {
var attachElecCity = mc_map.mc_places.attachMovie("Plant",
[code].....
View 1 Replies
May 5, 2011
I want to create a vector, then call a function that populates that vector with arrays. Fine. The only catch is the function itself will declare new array variables to put into the vector, but are these new array variables private to the function only?e.g. something like this
ActionScript Code:
public var vec:Vector.<Array> = new Vector.<Array>();
private function populateVec():void {
[code]....
Is this "kosher"? a was declared in the private function but added to something outside the function..?
View 4 Replies
Feb 18, 2010
I have taken variable in one function and want to use that value in another function.
View 2 Replies
Jan 23, 2012
how to get variable value from a function to a text box here is the code :
import fl.controls.ComboBox;
import flash.events.Event;
import flash.events.MouseEvent;
TxtAnswer = Array();
[code]....
.. i want that variable "sk1" to next scene text box ..i putted the code like this :
q1.text = sk1;
but it is not working..
View 4 Replies
Jun 24, 2011
me how I can use the variable from one function in another function?
For example:
function init():void {
var test:Number = 1;
}
[Code].....
View 1 Replies
Feb 1, 2010
I have created an actionscript function which stops an animation on a specific frame which works fine. I have then loaded in a php file with a variable which will contain the number for the frame i want the animation to stop on. This has loaded in fine and i have loaded it in a function. what i cant seem to do is to get the variable into the function which tells the animation to stop playing.
here is my code:
//load variablesvarReceiver = new LoadVars(); // create an object to store the variablesvarReceiver.load("http://playground.nsdesign6.net/percentage/external.php");//load variables
[code]....
View 1 Replies
Jun 8, 2011
I have this code:
for each(var tool in tools){
tool.addEventListener(MouseEvent.MOUSE_DOWN, function(){
trace(tool); //Always the last tool
});
}
How do I bind the value of tool to the function so that it's accessible on callback?
View 5 Replies
Feb 27, 2012
Can't seem to get the value of myXML outside the function, despite being declared outside. The data loads and traces correctly inside the function.
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("flightPlannerBoard.xml"));
var myXML:XML;
// Check XML data fully loaded
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = new XML(e.target.data);
//trace(myXML);
} trace(myXML);
View 3 Replies
Jul 5, 2010
I'm using the following class as part of my project:
Code:
package {
public class getData extends main{
[code]......
View 3 Replies
Sep 7, 2011
I have successfully passed a value to my function using another class.how do i know it works? Because when I put the trace statement in that function it gives me the value of the passed value.Now I want that value from that function to be get or to be used IN OTHER FUNCTION WHEREIN THAT FUNCTION IS ON ENTERFRAME. But I cant for some reason._a is a global variable
ActionScript Code:
package {
import flash.display.MovieClip
[code]......
View 2 Replies
Aug 14, 2004
I'd like to have a number of different functions named something like: "function1", "function2", "function3", all the way up to function100.
I'd like to be able to call them by adding the the number as a variable. For example:
type = 2;
function+type();
Which would call function2. I'm trying to avoid a huge if/else statement by only calling the functions I need.
Can a function be called if part of the function name is a variable? Is there another way to join "function" with the variable and then call it?
View 2 Replies
Mar 22, 2007
I have a array that gets passed straight into this function
Code:
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
trace(QuestionSet[0]['Question']);
}
Now I wan't to take the 'QuestionSet' array out of this function and expose it on the first frame (or on the _root. domain) so I can call it from OUTSIDE the function. So for example:
Code:
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
[Code]....
I can't just return the array because first i need to PUT IN the array in order to return it from the function which defeats the purpose!
View 2 Replies
Jan 3, 2008
Just get "undefined" with this:
Code:
hide_current = function() {
trace (_global.Klikk._y);
}
_global.Klikk is "mc_frontpage", which is the name of a movie clip i want to mess with.
View 1 Replies
Mar 2, 2010
Is there a way to reference a function via a variable? In other words, instead of saying something like:
var theVar = someString + 'function';
if (theVar == 'functionName') functionName ();
to access it directly:
(someString + 'function') ();
using some kind of bracket notation?
View 1 Replies
Apr 15, 2010
i have a function inside another function. Here is a structure of my code:
Code:
function loadXML(loaded) {
if (loaded) {
timer = new Array();
[code]....
As you can see, I declare timer array in the main function but I also want to use it in another function inside the main function. I have tried to call _root.timer and this.timer but it returned me undefined.How can I call it to use? Or how can I declare it properly?
View 4 Replies
Feb 13, 2009
I am having trouble getting a variable from within a function displayed. Basically I have a combo box, and want to pass the value of that to a global variable, but is does not seem to pass it.I have the following code:
PHP Code:
form = new Object();
form.change = function(eventObj) {
[code].....
View 6 Replies