ActionScript 2.0 :: Using Variable Undefined From XML

Aug 24, 2004

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?

View 8 Replies


Similar Posts:


ActionScript 2.0 :: Use Variable And Test It With Trace, The Variable Shows As Undefined?

Jan 13, 2004

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??

View 12 Replies

ActionScript 3.0 :: PHP Variable Is Undefined?

Jan 20, 2011

I have a flash file to start calling this function:

Code:
public function ConnectPHP():void
{

[code]......

View 1 Replies

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

[code]......

View 3 Replies

ActionScript 2.0 :: How To Check If Variable Is Undefined

Jan 9, 2008

How would I make an if statement to check if something is undefined

when I trace the variable, there are instances where it is undefined...I would like something to happen if the value of this variable is undefined...

I tried using null but that didn't seem to work

if(index == null)
{
...blah
}

View 4 Replies

ActionScript 2.0 :: Variable Undefined On Load?

Nov 2, 2009

I have this code:

ActionScript Code:
onLoad = function()
{
trace(_root.sliderPosition)

[Code].....

It monitors the sliders position, however, it doesnt track it. It only tracks it if i change it from onLoad to onEnterFrame.

View 3 Replies

ActionScript 2.0 :: Global Variable Undefined?

Jul 16, 2004

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;

[code]......

View 5 Replies

ActionScript 2.0 :: (mx 6)if Statement For A Undefined Variable?

Nov 6, 2003

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.

if ((x == "") || (x == " ") (x == Nan))
{
trace("here");

[code].....

View 1 Replies

ActionScript 2.0 :: Variable Shows As Undefined?

Jan 13, 2004

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??

View 12 Replies

ActionScript 3.0 :: Http_build_query() And URLLoader - One Variable Is Undefined?

May 14, 2009

i'm using a php file to send some data fromm db to flash via http_build_query(). The code here looks like this:

Code:
$user = mysql_query ("SELECT * FROM users ", $conn);
if (!$user){
die ("could not execute query: " . mysql_error());[code]...........

View 1 Replies

How To Get Text To Fade Out / In After Interval - Undefined Variable

Apr 5, 2010

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] .....

View 4 Replies

ActionScript 1/2 :: Set An Undefined Loaded Variable's Alpha To 0?

Jul 21, 2010

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() {

[code]......

View 7 Replies

Flex :: Filtering By Attributes Has Undefined Variable

Aug 24, 2010

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?

View 1 Replies

ActionScript 2.0 :: Dynamic Variable / Object -- Undefined?

Dec 14, 2009

why I am getting undefined every time I trace the following:

Code:
c = currentCount; //current is 1.
trace (eval("mcSlide" + c)._x);
trace (this["mcSlide" + c]._x);

I would think these would output, if I incrementally go through 3 slides, the correct _x for each slide e.g. mcSlide1._x , mcSlide2._x

View 1 Replies

ActionScript 3.0 :: Variable Is Undefined In Dynamic Type?

May 13, 2011

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.

View 4 Replies

ActionScript 2.0 :: Test An Undefined Variable With An If Statement?

Nov 6, 2003

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.

if ((x == "") || (x == " ") (x == Nan))
{
trace("here");
}

Someone could find me the correct if statemtn to check an undefined variable on action script 1, mx 6..develloped with MX2004Pro.

View 1 Replies

ActionScript 2.0 :: Sendandload Undefined Variable Receiving?

Feb 12, 2007

output is "error" even i send "hello". what is the problem here?

actionscript

Code:
function dothis() {
sv = new LoadVars();
rv = new LoadVars();[code].....

View 2 Replies

ActionScript 2.0 :: Variable Naming - Error_message Is Always Undefined?

Oct 3, 2007

I'm using loadVars in AS2 Flash 8 and PHP returns this string

success=false&error_message=xxx

The success variable traces fine but error_message is always undefined. Is it because the underscore is not allowed?

View 4 Replies

ActionScript 2.0 :: Undefined Variable Out Side Of Function

Apr 5, 2008

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]

View 1 Replies

ActionScript 3.0 :: GetDefinitionByName Throws Undefined Variable Error?

Sep 17, 2008

Flash CS3 project. Can anyone explain this:

var ViewClass:Class = views.Login;
view = new ViewClass();
// ^works fine

[code].....

View 2 Replies

Actionscript 3 :: Find Which Variable Is Undefined? (flash Builder)

Feb 7, 2011

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.

[Code]...

View 1 Replies

Flash :: Access Of Undefined Property (Static Variable)?

Jul 12, 2011

I'm trying to change a static variable in the class's constructor. At the start I have:

public static var mainReference:Main;
public static var timerReference:Timer;
public var timer:Timer = new Timer(1000);

This is so my static functions can access main and timer. At Main's constructor I have:

mainReference = this;
timerReference = timer;

The problem is, the first gives no error when I compile it, but the second tells me Access of undefined property (timerReference).

View 1 Replies

ActionScript 2.0 :: Printing User IP Address - Getting Undefined Variable

Aug 19, 2005

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] .....

View 5 Replies

ActionScript 2.0 :: Undefined Variable Using Xml To Load Names, Images?

Dec 5, 2006

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]....

View 14 Replies

ActionScript 2.0 :: Undefined Variable Loading External Text

Feb 8, 2005

Trying to augment the Kirupa tutorial "ActionScript Text Animation" [URL] to take an external text file. When I switch out the line:
text = "There is only one..."
with:
myLoadVar = new LoadVars ();
myLoadVar.load("davetextdoc.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
output.variable = "text"
output.text=myLoadVar.text;
}}
I get the word "undefined" repeatedly loading itself. The text file is properly formatted (text=dave's text here...) I've tried untold permutations to self-solve.

View 3 Replies

ActionScript 2.0 :: Global Variable Undefined On Main Movie

Jul 16, 2004

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;
trace("global defined as");
[Code] .....

When I do a trace of loadFile_str in the first frame of monthlyreports I get a undefined. I have tried trace(loadFile_str) and trace(_global.loadFile_str). I also noticed that if I define the global on the main movie (it maintains the global variable, the navigation fla will not overwrite it).

View 5 Replies

ActionScript 2.0 :: External XML Loads But Content Variable Remains Undefined?

Sep 5, 2005

what i have got is an external XML file that loads the news data into flash where it is there parsed and assigned to a dynamic text box and styled with a style sheet. Through trace() if found the xml gets loaded properly but when i upload it to a webserver it does not always load. Many times the variable just reads out undefined. If i refresh it a few times it will eventually load. This is not acceptable of course. It needs to try until it loads. I thought i had the code to make this happen but Im afraid im mistaken.here is the code, its inside the first frame of a simple swf with only the dynamic text box.

Code:
stop();
trace("1");

[code]......

View 4 Replies

ActionScript 3.0 :: Error #1065: Variable Undefined, Path To Container Mc In Loaded Swf Not Recognized

Jun 23, 2009

One movie, named Gallery_1, with hotpots via which external swfs are loaded into a container mc of the main timeline of the Gallery_1 movie,

Via another button function the Gallery_1.swf is loaded into a container mc on the timeline of the main swf, which works alright as well, but when one then clicks the hotspots of the Gallery_1.swf one gets following error message:

ReferenceError: Error #1065: Variable GallerySite not defined.
at HotSpot1/PictureLoad()
at HotSpot1/PictureCall()

[code]....

The traces in the eventHandler function work alright.I wildly imported all relevant classes I could think of, e.g. the GallerySite class to the WebSite class and vice versa, and tried various variable definitions, but am at a loss by now as to where to define the GallerySite variable.

View 3 Replies

ActionScript :: Error: 1120: Access Of Undefined Property MyRec On A Defined Variable

Nov 20, 2011

I'm trying to write a dollar recognizer in Flash Builder. actionscript and mxml, and I''m getting this error on the line "myRec.addTemplate..." in the code below:

import de.yuv.gestures.Recognizer;
import flash.display.Graphics;
import flash.display.Shape;

[Code].....

View 2 Replies

ActionScript 3.0 :: Passing A Variable To A Function - Get "error: Access To Undefined Property MyVariable?

Apr 9, 2010

It seems that with as3, the error compiler is just waiting to get you.I have a function that loads in an external swf. Which swf depends on which button they click. So, it could be pic1.swf, pic2.swf, pic3.swf, etc.

function loadMovie(){
my_mc.addChild(my_Loader);
addChild(my_mc);[code].........

When i test, I get "error: access to undefined property myVariable.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved