ActionScript 1/2 :: Variable Is Undefined Exactly After It Has Been Assigned?
Sep 1, 2010
I've written a class in AS2 that extends the Object class It's an abstract class for debugging purposes. The class is defined in an external .as file. The problem is that in an .fla file, after I assigned a variable to a new instance of the class, and I trace that variable, it comes back as 'undefined' The reason it's a problem is that I want to call methods on the instance of the Debug objectIn the .fla, I have the following code:
//import any external classes
import Debug;
//Create general application properties
I need a way to wait running the parseCSV command until the readFile event has updated the content of importData. I have seen a few things about custom event dispatchers but cannot quite figure out how to use them in my situation.
private var importData : String; public function importFile(event:MouseEvent):void { var data:String = chooseFile(); parseCSV(importData);
I have different textarea in a application and these have different Ids, once user move cursor inside in the specific textarea, delete button activate and it execute a function to remove this item, the Id of the textarea assigned as string variable, In this case how could i delete the component from Canvas
I've used similar code to this before in another project, but for some reason it's not working here: Code: var current:MovieClip; menu01.menuslide.arch.onRelease = function() { if (current != null) { Tweener.addTween(current, {_y:0, time:.5, transition:"easeOutExpo"}); Tweener.addTween(menu01.menuslide, {_x:0, time:1, transition:"easeOutExpo"}); [Code] .....
I need to assign a value equivalent to the name of the button that is being pushed to the variable 'current'. when I trace 'current', I get 'undefined'. I used this in the past in this way below and it worked: Code: a2.onRelease = function() { if (current != null) { current._alpha = 0; current.removeMovieClip(); attachMovie("002", "box002", 10, {_x: 0, _y: 30}); [Code] ..... Why the first code block isn't working?
here's what I'm talking about Here is the FLA file I have three checkboxes (not mx components) and a dynamic textbox on which the "showtext" variable is assigned. I want the dynamic text box to display the labels attached to checkboxes when they return a value of 1 : (box one is checked, box2 isn't so the label doesn't appear, and so forth.)
I figured I need to use an array for the checkbox labels. I probably need a loop that verifies which checkboxes are checked (value=1). and use an array to combine the checked boxes with their respective label.
I am tring to create a simple mine game..so I created a couple movie clips one of which is to be assigned a value of "0" and the other is to be assigned a value of "1" randomly. That is if the one on the left has "0" the other should have "1" and that if I click the one having "0" value ,let it explode or do something..The problem is that I am not sure how to use "onClipEvent(enterFrame)" and on(press).. I named my MCs as "mcleft1" and "mcright
we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.how can we make this work without it coming up as undefined??
I have a situation where I am reading a wide variety of data from an XML file, and if a particular bit of data is not there, I simply want to hide a button. Before I go further, all my XML data in and out works fine, that's not a problem.
If I have this node in my XML: Code: <name1></name1> read it in, assign to a variable and check that variable in the debugger I get this: Code: Variable _level0.assocImageName1 = undefined This is fine. It has no value, so it's undefined.
Now, if I do the most simple of If statements this check just doesn't work. I've tried something like: Code: if (_root.assocImageName1 == undefined) { _root.linked._visible = false; } else { break; } Now the odd thing, is that with quotes ("undefined") or without, this doesn't work reliably. It seems to just run right past the If and perform the hiding of the button regardless.
Also, if I put something in the XML like so: Code: <name1>data</name1> I get this in the debugger: Code: Variable _level0.assocImageName1 = "data" And check for that like this it doesn't work: Code: if (_root.assocImageName1 == "data") { But oddly enough, if I take the quotes off it does work. What's going on there? I thought you also had to always use quotes when testing a string?
here is the set up. I'm working with three files. Main.swf which contains navigation.swf in a blankmc, empty mc called mcContent where navigation sleclected materials are loaded.
In the navigation.fla here is the code [AS]trace("now defining global"); _global.loadFile_str = strPicName;
How can I test a undefined variablewith an if statement.all a this did not work and I don't want to define a value for this variable.name of the variable x.
we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.
how can we make this work without it coming up as undefined??
I have borrowed the code from Tiago's web blog. [URL]. I have noticed a few odd things, and have tried to send off to Tiago himself but have not received any response. The first thing I noticed is the code seems to call for the .php file before it can load, so at times it will generate a "undefined" for both the quote and author. The second thing is, which may tie into the first, there seems to be the occasion where the code doesn't load the php file at all. The author and quote will be blank for a duration. And the third question I have is how do I get the text to fade out again after the fade in after an interval.
Code: import caurina.transitions.Tweener; var quote:Array = new Array(); var author:Array = new Array(); var totalQuotes:Number; var rotateTimer:Timer = new Timer(10000, 100); //rotates the quote every 2 seconds for 100 times [Code] .....
I'm trying creating a flash navigation bar that can be edited via a simple text file. I'm able to load my different variables properly but i also want to give the user the ability to remove links. I can simply leave the variable from the text file blank and and have the text in the swf disappear but i also want to be able to set the alpha of the movieclip behind the text to zero when the variable is left blank. Alternatively, even if the user could simply set the variable to the string "Blank" and both the alpha of the dynamic text and movieclip would change to zero that would be functional as well. Here is the code i have so far.
NavLoadVar = new LoadVars(); NavLoadVar.load("navigation.txt"); NavLoadVar.onLoad = function() {
I have some xml and I am trying to filter it using e4x. My e4x statement looks like this: model.config.source.fees..fee.(@min<amount).@amount
My xml looks liks this: <flex><fees> <fee type="credit" min="0.00" max="200.00" amount="6.00"/> <fee type="credit" min="200.01" max="370.00" amount="10.00"/> </fees></flex>
When the e4x statement is run, I get an error message: Error #1065: Variable @min is not defined. But if I change my statement to model.config.source.fees..fee.@min it will return an xmllist of all the min attribute values, so min is defined, at least in that statement. Why doesnt the original statement work?
without having to make my movieclip (from a swc) a global variableThe code works perfectly, but i'm guessing it's redflagging it because it's not a waterproof method.
im pulling in an xml document. Ive pushed all the nodes in to arrays and have successfully performed calculations on some variables. Now, i have the arrays defined as _.global arrays, but when i try and trace them outside the function they are undefined. They trace fine inside the function.Is ther anyway of accessing these variables outside the function?this is my file, as you can see at the botttom i am trying to trace the variables but it wont work?[code]
A flash application in flash builder is currently throwing this error:
ReferenceError: Error #1065: Variable is not defined.
Not telling me which variable it is that's not defined, but note there are two spaces between 'variable' and 'is'. and it gives me some more feedback as to what lines of code are having trouble, but those lines are all within the actual flash/mxml packages and not any of the files in my own project.
I suspect it's related to my php data/services, but I don't see what variable would not be defined. I'm not very familiar with debugging, so I'm not sure how to determine with it where the problem is cropping up.
I want to print the user's IP address in Flash via a PHP script, but keep getting an undefined variable (printed as "undefined"). Here's my PHP script:
PHP Code: <?php // Script for getting IP $yourip = $_SERVER['REMOTE_ADDR']; echo ("yourip=".$yourip); ?> [Code] .....
I'm working on a photogallery and I'm using xml to load names, images.the problem is: I want a button to open a new browser window but something is wrong with the variable, I think it is because of the function, but still don't know how to solve it.
this.onEnterFrame = function() { var bytes_loaded = holder.boton.getBytesLoaded(); var bytes_total = holder.boton.getBytesTotal();[code]....