ActionScript 2.0 :: Read Value Of A Variable From A Function?
Oct 28, 2009
I have a function that makes an array and I am trying to read the contents of the variable outside the function but it keeps giving me the result as undefined.
I know there must be a simple solution to what i am attempting to do.[code]...
View 0 Replies
Similar Posts:
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
Sep 25, 2009
ActionScript Code:
var city:String = "Bath";
var xml:XML = new XML();
var urlloader:URLLoader = new URLLoader();
urlloader.load( new URLRequest("[URL]") );
urlloader.addEventListener("complete", xmlComplete);
function xmlComplete(e:Event):void{
[Code] .....
The main part is where I have created the variable: IconGif... it reads a portion of the xml file and turns it into a rference that will eventually relate to an instance name of a movieClip. I was going to use:
ActionScript Code:
this.attachMovie(IconGif,IconGif,100);
to place the item on the stage to whatever the xml says that day,
My problem occurs because the function I have used to create the variable, clashes with the attachMovie function and I receive the message:
TypeError: Error #1006: attachMovie is not a function.
at weather_fla::MainTimeline/xmlComplete()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader:nComplete()
Whatever that means but when I try to call the variable outside of the function, it doesn't know what I'm no about, because as far as it's concerned it doesn't exist, but only when the function is being called. I'm not the wisest with XML and calling up data...
View 8 Replies
Mar 20, 2009
How can I read a variable from URL so that it can be used in my swf? I have 'main.swf' loaded in 'mainpage.html'. I am using getURL to pass variable from this swf to the URL of another html page(secondpage.html)......
[Code]...
View 4 Replies
Jun 22, 2011
Try to read xml data into a variable to put it out in an
xml scheme
<akws>
<akw>
<name>test</name>
[code]....
now I want the number in <_5> into an s:Label
private function countpop():void{
popsum = parseInt(xmldata.akw[1]._5);
}
but
<s:Label text={popsum} />
gives me NaN?
View 1 Replies
Jul 28, 2007
I need to set a variable to the contents of an input box. How do I do this?
View 6 Replies
Jan 15, 2011
Basically, imagine two classes, for simplicities sake I'll call them classA and classB they are in the same folder, same project, and all variables have been called as public.
In classA there's a variable, for this example I'll call it speed (its called something else obviously as speed alone turns blue so its a reserved word). It is made and updated in classA for it's current value
classB handles the array to move things, and needs to reference what speed is so it knows how much to move each object each tick.
How do I allow classB to look in classA and see what the current value of speed is?
View 4 Replies
Mar 27, 2012
How do I add a variable to a string and then read it?I have:_root.compassItem = 'Item';I have a movieclip that has an instance name of Item and it is inside the movieclip _root.mWorld.so I assume its instance would be _root.mWorld.Item.I want to get its ._y dynamically. How would I do this?I am trying: trace(_root.mWorld._root.compassItem._y); But, it is returning undefined.
View 3 Replies
Jul 9, 2009
I currently have a flash video player and I want to add some code that will update a variable in an external .as or .txt file. I then want to be able to pull this variable into a different .swf when required.
My variable I want to create will be CurrentVideo and it needs to be a number e.g. _global.CurrentVideo = 2
View 1 Replies
Mar 29, 2009
Given that there is a global javascript variable on my web page named myVar, how can I access the value of the variable myVar from within my flash movie using javascript?
I see plenty of examples of using external interface in order to execute javascript from actionscript, but I am unable to find examples of returning values back into the flash movie using actionscript.
View 1 Replies
Jan 14, 2011
What is the best way to have a flash text box read a PHP session variable? I want to do something like show a shopping cart total price in the text box which would be stored in a PHP session variable.
View 2 Replies
Apr 13, 2009
My html:
Code: Select all<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
[Code]....
Do I need another variable that flash can read? Not much documentation on any of this...
View 2 Replies
Jan 6, 2010
I am trying to send a php variable with one field from mysql. When I print the php variable on my php page it outputs the field, but when I try to send it to flash it doesn't output anything.Here is my php script that tries to send a mysql field to flash and there nothing is shown. It works on my php page, it outputs the mysql field.
$product=$result['product'];
$pro=$product;
$pro = "&pro=".$pro."&"; //~ make it a flashable variable
[code].....
View 2 Replies
Jul 3, 2009
in a flash template i found several buttons with almost the same action script code. on pressing the button a window popup with different text (for each button a unique text). the following code is in the code section of the buttons, only the two last codelines are different for each button.
[Code]...
so i think that the input of the unique text for each button is handled in the last line "_root.READ = 22". i also found in the bibliothek the belonging text parts. my problem now is that i dont know where the connection is set between the text part and the array/variable READ. in this case the connection is 22, but i dont found any property in the text part or in the property of the button where the connection is set to 22. i use flash cs4.
View 3 Replies
Sep 11, 2009
I have a number of checkbox's on the stage. The client would like the half dozen or so checkbox selections to be in a random order each time the frame is viewed. Simple enough, I created a random array...
Code:
var Q3Labels:Array=["17p deletion","p53 mutation/deletion","11q deletion","Trisomy 12","13q deletion"];
function getQ3Labels():String {
[Code].....
But when I test this code I get a "1084 Syntax error: expecting rightparen before .", so it seems it's reading Q3A as literally "q3a_chkbox.label" not "11q deletion" (or whatever). If I change the Q3A variable to simple text then it works fine,
View 0 Replies
Jul 28, 2009
I have a sample.txt file which contain a single word and I need to put this word into a variable on swf.[code]...
View 5 Replies
Aug 25, 2010
I declared a variable & it's value in the main timeline. Then I created a movieclip and have some actionscript inside that movieclip. Is it possible to read the varialbe's value within the movieclip?
Let's say I have this variable in root timeline var myVar:Number = 100; and I want to read myVar's value within a movieclip like following trace(root.myVar);
View 3 Replies
Mar 10, 2009
There's a RadioButtons group (=Group3) and event listener applied on it. The value of _root.choices3.a3.data is "a". The code is following:
trace("DATA BEFORE" + _root.choices3.a3.data);
var rbListener3 = newObject();
rbListener3.click = function() {
trace("I am inside.")
trace("DATA INSIDE" + _root.choices3.a3.data);
}
_root.choices3.Group3.addEventListener("click",
rbListener3);
If I compile it, the output is:
DATA BEFORE
I am inside.
DATA INSIDE
Why can't I read the value of _root.choices3.a3.data inside the function?
View 1 Replies
Jan 21, 2009
The trace commands illustrate the problem - The playString function does not seem to be able to read the array created by the getChord function. It reads the default values listed below.
private var chordArray:Array =
["6,0","5,0","4,0","3,0","2,0","1,0"];
private var chordArrayCopy:Array = new Array();
A little background - getChord function is called from one class file and playString function is called from another. I don't know if this has anything to do with it. But that's why these are public functions within a public class.
View 3 Replies
Mar 6, 2010
I have a flash movie that moves ahead in the animation based off the audio. I've broken the movie up into a few scenes so that I can keep things really easy for myself. However because I'm using the same function to read the audio in the different scenes I'm getting a duplicate function error. Original Function that works great in the individual scenes but fails when played together:
Scene 1Scene 2import fl.video.MetadataEvent;
audio.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
function cp_listener(eventObject:MetadataEvent):void{
[Code] ....
How to end the listeners after they have finished. I have no idea if that will work...
View 3 Replies
Sep 28, 2011
I have a function that reads bytes from a stream, but the bitwise shift left only allows you to shift up to 32 bits it looks like.
Code:
function ReadALong(obj:*):Number {
var val:Number = obj.readUnsignedByte();
for (var L:Number=1;L<8;L++) {
var Add:Number = obj.readUnsignedByte() << (L*8);
val = val + Add;
} return val;
}
View 1 Replies
Jan 25, 2007
I need to parse and display the value for variable VALUE in xml to the screen but read from the file continuously instead of
once. The XML file is being created dynamically so its getting larger but flash only displays first value for variabel VALUE.
View 5 Replies
Oct 9, 2008
How to read a variable from main.swf (that load content.swf) and use it inside content.swf?
I have a variable called TextColor = "Green" in the main movie and I want to read this variable from inside the content movie?
View 5 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