Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Null NodeVale In Xml Array



I keep returning a null value when trying to loop thru the following xml :


Code:
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />
<title>Somebody's's playlist</title>
<trackList>
<track>
<location>http://www.......mp3</location>
<annotation>Some Artist - Song Title 1</annotation>
<image>http://www......jpg</image>
<code>123456</code>
<duration></duration>
</track>
<track>
<location>http://www.......mp3</location>
<annotation>Some Artist - Song Title 2</annotation>
<image>http://www......jpg</image>
<code>123456</code>
<duration></duration>
</track>

etc......

</trackList>
</playlist>
with the following code:

Code:

import mx.utils.Delegate;

/********************************
(2)----declare local reference to main timeline; I avoid "_root" in
case this Player is used in a Flash Movie with other elements
*********************************/
_global.mainTL = this;

/***************************************
(10)----XML Object definitions
*****************************************/
varList_xml = new XML();
varList_xml.ignoreWhite = true;

//specify which function to handle on load event
varList_xml.onLoad = Delegate.create(this, varListLoaded);

//the callback function called by the XML onLoad event
function varListLoaded(success:Boolean){
if (success) {
var mainNode:XMLNode = this.varList_xml.firstChild;
var resourceCount:Number = mainNode.childNodes.length;
for (var i = 0; i<resourceCount; i++) {

trace(i+" = "+mainNode.childNodes[i].nodeName+" - "+mainNode.childNodes[i].nodeValue);

if (mainNode.childNodes[i].nodeName == "trackList"){
var trackCount:Number = mainNode.childNodes[i].childNodes.length;
trace("trackList count = "+trackCount);
for (var j = 0; j<trackCount; j++) {
trace(j+" = "+mainNode.childNodes[i].childNodes[j].nodeName+" - "+mainNode.childNodes[i].childNodes[j].nodeValue);
}
}
}
} else {
trace("Failed to load the XML file");
}
}
varList_xml.load ("Playlist.xml");
Can anyone figure out why I get null nodeValue in both loops above?

I am trying to return each location and annotation tag.

thanks



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 04-27-2007, 07:10 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Problem With 2D Array And Null Values
I'm sure this is a really simple question for anyone who's come across it before.
I have a grid of objects. I'm comparing properties of objects above, below, left and right of an object in the grid when clicked.

This is fine until I click on an object on one of the sides of the grid, then it's returning null - like you'd expect.

I thought i'd solved the problem like this...

right = GlobalVars.allBlocks[row][col + 1];
if (right == null) { right = GlobalVars.empty; }
left = GlobalVars.allBlocks[row][col - 1];
if (left == null) { left = GlobalVars.empty; }
above = GlobalVars.allBlocks[row - 1][col];
if (above == null) { above = GlobalVars.empty; }
below = GlobalVars.allBlocks[row + 1][col];
if (below == null) { below = GlobalVars.empty; }

However this only works with the "left" and "right" MovieClip references, but the "top" and "bottom" throw a TypeError: Error #1010: A term is undefined and has no properties. - if i try to catch the error it throws a TypeError: Error #1009!

Why would the left and right work fine, but not the top and bottom?!

Any ideas?

Andy

A Null Problem That Isn't "null" To Me
Hi all...this is driving me around the bend



Code:
var currentMC:MovieClip = null;



function Open(evt:MouseEvent):void {

if (currentMC !=null) {
Close()

}

switch (evt.target.name) {
case "contact":
currentMC = contactMovie;
break;
case "purchase":
currentMC = purchaseMovie;
break;
case "uses":
currentMC=usesMovie;
break;

case "photos":
currentMC= photosMovie;
break;
case "testimonials":
currentMC =testimonialsMovie;
break;
case "about":
currentMC =aboutMovie;
break;
}

currentMC.y=175;
currentMC.x=900;

addChild(currentMC);
Tweener.addTween(currentMC, {x:370, time:.5, delay:0, transition:"linear"});

}

function Close() {
removeChildAt(getChildIndex(currentMC));

}
returns a error :TypeError: Error #1009: Cannot access a property or method of a null object reference.
at siteworkingTween_fla::MainTimeline/Open()

all the coding and names seem to be right. I made a simplified version with EXACTLY the same code to try it out and it worked. But for some reason in this particular instance it does not. Debug shows the error at


Code:
currentMC.y=175;
I am at loss of where to start to correct this.

Thank you so much.

If Something Do Null?
I've a wee if statement here:

.
Code:
on (rollOut) {
if (web == "true") {
stop();
} else {
getURL("cursor:out");
}
}


now I dont want a stop action there, I just want it to do nothing, whats the code for nothing

Using Null In AS3
I have a function that passes a null argument the first time it is called. This worked well in AS2, but reports the good old error 1009 in AS3. I have tried using null and undefined.

The function is declared here:

Code:
function playBucket (theBkt, oldTxt, newTxt):void{
var revealTx3:Tween = new Tween (oldTxt, "alpha", Regular.easeInOut, 100, 0, 15, false);
revealTx3.addEventListener(TweenEvent.MOTION_FINISH, revealTx3Fin, newTxt);

var revealBkt:Tween = new Tween (theBkt, "alpha", Regular.easeInOut, 30, 100, 10, false);
revealBkt.addEventListener(TweenEvent.MOTION_FINISH, revealBktFin, theBkt);
};
The function is called here:

Code:
function revealTx2Fin (e:TweenEvent):void{
playBucket(bkt1_mc, null, instrTx1_mc);
};
So what is the new correct way to pass an undefined value to a function?

Many thanks helping a once-again-newbie find his way in the post-AS2 world
mm66

Set To Null
I'm currently working my way through C.Moock's Essential AS3 book and am currently looking at 'Event listeners and Memory Management' (page 216 if you've got a copy). The chapter suggests a hypothetical butterfly game for which to remove stranded listeners. Me being me has to emulate the whole thing in order to understand it properly, which means in this case adding flappy butterflies to the stage - (the book just suggests this would be the case) . I think I've approached it correctly...? and the whole thing works as required, I've removed the timer listener at the point I destroy/click the butterfly but am not sure about setting the new Butterfly class/object created in main Butterflygame class to null - do I trigger a function from Butterfly in Butterflygame to set butterfly to null? would that set them all to null?? I would be very grateful if someone could explain in plain numpty language.
Many Thanks
Mikeb








Attach Code

package {

import flash.display.*;
import flash.utils.*;

public class ButterflyGame extends Sprite {

private var timer:Timer;
public var butterfly:Butterfly;
public function ButterflyGame():void {

timer = new Timer(500,0);
timer.start();
for (var i:Number = 0; i < 5; i++) { // loop to add multiple butterflies
butterfly = new Butterfly(timer);
addChild(butterfly); // read here (http://greenethumb.com/article/23/understanding-root-and-the-document-class-in-as3) that this will add
// the new butterfly() created above to the display list and then the butterfly class can access stage objects etc..
}
}

}
}
////////////////////////////////////////////////////////

package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.transitions.*;
import fl.transitions.easing.*;


public class Butterfly extends Sprite {

private var gameTimer:Timer;
public var newBfly:bfly = new bfly(); //this is a linked movieclip in the main fla library
public function Butterfly(gameTimer:Timer) {
this.gameTimer = gameTimer;
this.gameTimer.addEventListener(TimerEvent.TIMER, timerListener);
addChild(newBfly); //sticks the mc above on the stage
newBfly.addEventListener(MouseEvent.CLICK, destroy);// added listener to mc to remove itself when clicked


}
public function timerListener(e:TimerEvent):void {

//some random tweening routine - code removed - does work though!//

}
public function destroy(event:MouseEvent):void {

gameTimer.removeEventListener(TimerEvent.TIMER, timerListener); //as reccomended in the book removes stranded listener(s)

//parent.removeChild(this); //either of these work
ButterflyGame(root).removeChild(this); //either of these work



}

}
}

Null ?
I'm trying to make an application but I don't this IF condition.

measuredValveClearance1=Number(a1_txt.text);
//--- problem
if (measuredValveClearance1 == Null) measuredValveClearance1=0;
//-- end problem

old1=Number(b1_txt.text);
var res1=(measuredValveClearance1-clearance1)+old1;
c1_txt.text=(res1);

How do I do to in the scenario the user doesn't enter any value for measuredValveClearance1 to make the value 0

Can anybody tell me the right syntax / way to do it?
Tx

Use Of Null?
I have a FLV player with standard controls. I have also made another play buttons that sits ontop of the video until it starts playing.


ActionScript Code:
vidPlayer.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePlaybtn);//when you click the play button I made it calls startVidfunction startVid(e:MouseEvent):void{    vidPlayer.play();    hidePlaybtn(null);}function hidePlaybtn(e:VideoEvent):void{    TweenLite.to(playBtn,1,{autoAlpha:0,ease:Exponential.easeOut});}


my problem was, in the startVid function I call hidePlaybtn(). I first had it like hidePlaybtn() and it was giving me an error because hidePlaybtn() is expecting a VideoEvent. So I just put null in their and it worked fine. I never really used null before, but is that ok what I did or is their a more proper way of doing it?

OnEnterFrame = Null?
Is this a proper way to turn off an onEnterFrame function without losing it?
Code:
onEnterFrame = function (){
blah, blah, blah;
}
if (this and that) {
onEnterFrame = null;
}

OnEnterFrame Null
Hey guys
I have a function that is couched in a an onEnterFrame command. I set it to null when I hit a certain button. However, how can i "unnullify it". In other words, what is the opposite of the null value. Just like false is the opposite of true, what is the opposite of null. Thanks guys
Don

Delete Vs. Null
just curious if there is any efficiency difference between using null versus delete. in other words, does it take less time or use less overhead to say:

delete this.onEnterFrame;
versus
this.onEnterFrame=null;

any info you have on this question, or any info at all related to delete vs. null would be greatly appeciated.

cheers
j

Parent To A Null?
Hello, I'm fairly new to Flash 8, and have a question about an effect I'm trying to achieve.

Example:

In After Effects, I can parent one object (child) to another object (parent). When I move the parent, so does the child.

How would I accomplish this with two movie clips in Flash 8?

Speficifallly, I'm scripting a tween for one object after a mouse click, but want to move a second object to move 90% of the x and y position of the first object.

I'm not sure where to start with the parenting/following bit.

The end goal is to achieve a multiplaning effect in my interface with "closer" objects moving slower than "further" objects.

thanks,

-SF

A Var Named Null
hello,
i have a situation where i have a variable named "null" on _root.
how do i trace it or check its content?

Null Error
So I have an error message like so...


Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Controller/loadXML()
at Image/loadXML()


Claiming that I have a access property that is null.... I don't know how this is possible, but I am willing to sugestions. Here is the code for the Controller and the loadXML for the Image class.

Controller:

Code:
package
{
public class Controller
{
private var model:Object;
private var stuff:Array;

public function Controller(model:Object):void
{
this.model = model;
}

public function loadXML(sectionName:String, image:Object):void
{

stuff[0] = sectionName;
stuff[1] = image;
model.loadXML(stuff);
}


}//end control
}//end package



Image class:


Code:
public function Image(model:Object, controller:Object)
{
this.model = model;//puts model object into var for the class
this.controller = controller;//puts controller object in var for class
this.model.registerView(this);//tells model to register this class


this.icon_btn.addEventListener("click", loadXML);
}


public function loadXML(evt:Event)
{
var sectionName:String = "section";//adds the name which the XML will look for
this.controller.loadXML(sectionName, this);
}


Thanks for any help!

What Happens If You Assign Null To This.
if you state:

PHP Code:



this = null;




what will happen to all the references to the current object? will they turn null, or what?

Opposite To Null?
i have an onEnterFrame script that i set to null.

How do activate it again? without moving to a different frame.

I've tried:

PHP Code:



preloader_mc.onEnterFrame!=null; 




Cheers,
bl

Null À Function
I have a movie clip where at some point I do this:

mcProd.onRelease = function (){
the code;
}

But later on, I need this specific movie clip to be unclickable...is it possible to remove a function or null it so that even the little hand doesn't appear?

Remove Null Value
Hi,
I have the following code which displays details within a multiline text field.
This all works fine however if the value for company[i].company_details['pm_company_address_2'] is null/contains no value how can i remove this.
I have tried applying an if statement but it keeps breaking the code.
If there is a better alternative i would like to hear your thoughts.

Code:
company_detail_mc.company_details.multiline = true;
company_detail_mc.company_details._width = 186;
company_detail_mc.company_details.styleSheet = styles;
company_detail_mc.company_details.text = "<p>"
+ company[i].company_details['pm_company_address_1'] + "<br>"
+ company[i].company_details['pm_company_address_2'] + "<br>"
+ company[i].company_details['pm_company_city'] + ", "
+ company[i].company_details['pm_company_state'] + " "
+ company[i].company_details['pm_company_postal_code'] + "</p>";
company_detail_mc.company_details.autoSize = true;
xHeight = company_detail_mc.company_details._height;

Null And Undefined
I have really never thought about this but what is the difference between null and undefined?

Opposite Of Null?
Hello!

I've used myFunction = null;

to kill some functions... but later on I want them back..

How do I un-null a function once it's been brutally killed off?

P

Null Vs Undefined And The GC
As I understand it, the only time "undefined" is applicable in AS3 is for untyped variables. If you try to assign a typed variable the value "undefined", then the default value of that variable type is assigned by Flash (eg var str:String = undefined would be changed by Flash to str = null).

My questions are this:

If a variable's value is null, the GC might collect it. If collected however, is the variable definition still available for future assignment or is it wiped from the program altogether and unavailable for future use/reassignment?

If the definition does persist, but has a null value, is there any way to delete the variable altogether and wipe it from the program entirely, never to be assigned a value again?

Null Check
Hey everyone

I'm using a pre-made script to create a gallery (thumbnails + enlarged images).

The thumbnails are stored in "holder_mc" and the enlarged images are stored in "largeContent". I'd like to remove these two childs when a certain frame is reached.

To do that I used this code:

Code:

removeChild(holder_mc);
largeContent.removeChild(loader.content);
The problem with using this is that sometimes the user reaches the frame that contains this code without viewing the gallery first. In other words, Flash tries to "removeChild" targeting 2 symbols that were not created in the first place; As in, symbols that are null.


How do I make it so flash checks whether holder_mc and largeContent are null or not, and only if they are not null will the code above run?



(I tried this but it didn't work, what am I doing wrong?


Code:

if ((holder_mc)== null){
removeChild(holder_mc);
}

if ((largeContent)== null){
largeContent.removeChild(loader.content);
}

)
Thanks!!!

If (myMovieClip = Null){ ?
I have been using this code for a while now and simply list all animated movie clips in a function like this...


ActionScript Code:
if (myMovieClip != null){
myMovieClip.stop();

I also make another function to play each movie clip.

The problem I am having now is I THINK when the movie clip isn't present at the beginning of the scene (Where the above code is) I get an "Access of undefined property" error. I dont know why I am getting this because I was hoping that if myMovieClip is null then it would ignore the rest of the if statement and go onto the next, but I could be wrong. Can anyone explain exactly what is going on here.

Cheers

Null Coercion
Hiya ...

I'm trying to get a String into a addChild object ... i thought my coercion would be ok - but its tracing 'null' (checkObj) when the String (animal) traces ok .


ActionScript Code:
var animal:String = thisClass + "Class";
    var checkObj:MovieClip = this[animal];
    trace(checkObj);
    trace(animal);
    addChild(checkObj)

i don't know whats in my code causing it to bomb .

any ideas ?

Xml String Is Null
if I trace out streamPlay inside the ReadContent function then it traces correctly. However if I trace streamPlay elsewhere it returns null...why?


ActionScript Code:
streamPlay:String;
function ReadContent(Client:XML):void {
trace("XML Output");
trace("------------------------");

streamPlay = Client.stream[0].file;
}

What Does Object=null Mean?
Hi, what does the following function declaration mean?


Code:
public function foo(bar:Object=null):void{
....
}

Does it mean that if I do foo() (I don't pass an argument), then bar will be null? And that if I do foo("duh"), then bar will be "duh" ?

Thanks in advance,
Nitro

XML - NodeValue=null?
Code:

ActionScript Code:
testXML = new XML("<cat>fluffy</cat><dog>spot</dog>");
testXML.ignoreWhite = true;
test = testXML.childNodes;
for (length in test) {
    i++;
    temp = test[(i-1)].toString();
    tempXML = new XML(temp);
    tempXML.ignoreWhite = true;
    trace(tempXML.firstChild.nodeName+" -> "+tempXML.firstChild.nodeValue);
}
Output:

Quote:




cat -> null
dog -> null




I'm going nuts. All I want is fluffy and spot back.

So yeah, basic walkthough: I create an XML object, turn it into an array of nodes, then create new XML objects from the nodes. With the objective being knowledge of what node I'm stripping, and the value of that node.


But I can't seem to coerce a value out of this XML...

It is driving me mad. Perhaps I don't understand what is going on. =[

String = Null;
how do I set a sting equal to zero

I have tried:

blah = 0;
blah = 0
blah = "";
blah = ""

how do I do it?

Can Uint Be Null?
so ive got this method and FDT is complaining about uint not being able to be null. true?

public method SomeClass ( n:String=null, id:uint=null ) {}

OnEnterFrame = Null?
I am using a function for a simple pacman game (im new to flash and i wanna try to make the game and refine it as i get better)....the function makes the onEnterFrame for the ghost null and when the dead_ghost_mc gets to the originating ._x and ._y it will make the onEnterFrame accesible again. My problem is once the onEnterFrame is made null i can never get it back.

this is my code so far:


//green eatable is assigned a 1 when pacman eats green_ghost_mc
//green_ghost_dead_mc is the movie clip that turns to eyes and finds
//its way back to the starting coordinates.
//once at the starting coordiantes the original ghost returns
green_ghost_dead_mc.onEnterFrame = function()
{
if(green_eatable == 1)
{
green_ghost_mc.onEnterFrame = null;
if(green_ghost_dead_mc._x > 309)
{
green_ghost_dead._x--;
}
else
{
if(green_ghost_dead_mc._x < 308)
{
green_ghost_dead._x++;
}
else
{
green_ghost_dead_mc._x = 308.7;
}
}
if(green_ghost_dead_mc._y > 204)
{
green_ghost_dead_mc._y--;
}
else
{
if(green_ghost_dead_mc._y < 203)
{
green_ghost_dead_mc._y++;
}
else
{
green_ghost_dead_mc._y = 203.15;
green_eatable = 0;
green_ghost_mc.onEnterFrame; //how do i make this accesible?
}
}
}
}

Calcfields Comes Up NULL
Hi, I'm using flash 2004 professional. I'm trying to make a calculated field in a dataset but am having some trouble.

I've tried to follow the example used in the flash help.
I have a dataset named "ds".
I have 3 input text components called "f1" , "f2" and "box1"

In the ds schema, i've made 3 items -- "price", "quantity" and "totalPrice".

All 3 have datatypes set to Number.
"totalPrice" Kind is set to Calculated.

I have f1 bound(out) to ds.price -- f2 bound(out) to ds.quantity -- and box1 bound(in) to ds.totalPrice.

On the first frame of the movie i have this actionscript:

function calculatedFunct(evt) {
evt.target.totalPrice = (evt.target.price * evt.target.quantity);
}
_root.ds.addEventListener('calcFields', calculatedFunct);


When i run the movie and try to input numbers into f1 and f2, I get "NULL" in box1.

What am i doing wrong?

Thanks in advance, db

If (man.hitTest(none)){ Null
Hi is there a simple way to detect if a hit test is null?

I am trying to make something happen if the hit test is called and something else when it does not exist.


Code:
if (man.hitTest(mostache.dude)){
_root.mostache._x = man._x;
Caption_Create(true, "HELLO I AM BLAH", this);
}
if (man.hitTest(none)){
Caption_Create(false);
cheers

Opposite Of Null?
Hello,

I've killed some functions in my game with myFunction = null;

But later on I want them back! ie when I reset some stuff...

How do I un-null?

P

Help W/ A Null Error
greetings,

another newbie question...

I am trying to use a drag n drop function to place a word in a correct spot.

once the word is dragged to this spot I want the movie to go to the "correct" frame.

it works, but I get this error message about "void and null"

here's the code


Code:
if (Ego.hitTestObject(hitSpot)) {
gotoAndPlay("egoCorrect");
Ego is the MC I'm dragging
hitSpot is the area I'm dragging it too
egoCorrect is where it's supposed to goto once the collision happens
thank you!

Null In AS3 Compared To AS2?
I have a flash file where I have a button with a mouse event and over it I have a movie clip. In AS2 I would write:

mc = null;

and the movie clip will still be there but I will still be able to interact with my button.

In AS3 this doesn't work, does anyone know how to null an object to still interact with whats underneath?

OnEnterFrame = Null?
I am using a function for a simple pacman game (im new to flash and i wanna try to make the game and refine it as i get better)....the function makes the onEnterFrame for the ghost null and when the dead_ghost_mc gets to the originating ._x and ._y it will make the onEnterFrame accesible again. My problem is once the onEnterFrame is made null i can never get it back.

this is my code so far:


//green eatable is assigned a 1 when pacman eats green_ghost_mc
//green_ghost_dead_mc is the movie clip that turns to eyes and finds
//its way back to the starting coordinates.
//once at the starting coordiantes the original ghost returns
green_ghost_dead_mc.onEnterFrame = function()
{
if(green_eatable == 1)
{
green_ghost_mc.onEnterFrame = null;
if(green_ghost_dead_mc._x > 309)
{
green_ghost_dead._x--;
}
else
{
if(green_ghost_dead_mc._x < 308)
{
green_ghost_dead._x++;
}
else
{
green_ghost_dead_mc._x = 308.7;
}
}
if(green_ghost_dead_mc._y > 204)
{
green_ghost_dead_mc._y--;
}
else
{
if(green_ghost_dead_mc._y < 203)
{
green_ghost_dead_mc._y++;
}
else
{
green_ghost_dead_mc._y = 203.15;
green_eatable = 0;
green_ghost_mc.onEnterFrame; //how do i make this accesible?
}
}
}
}

Calcfields Comes Up NULL
Hi, I'm using flash 2004 professional. I'm trying to make a calculated field in a dataset but am having some trouble.

I've tried to follow the example used in the flash help.
I have a dataset named "ds".
I have 3 input text components called "f1" , "f2" and "box1"

In the ds schema, i've made 3 items -- "price", "quantity" and "totalPrice".

All 3 have datatypes set to Number.
"totalPrice" Kind is set to Calculated.

I have f1 bound(out) to ds.price -- f2 bound(out) to ds.quantity -- and box1 bound(in) to ds.totalPrice.

On the first frame of the movie i have this actionscript:

function calculatedFunct(evt) {
evt.target.totalPrice = (evt.target.price * evt.target.quantity);
}
_root.ds.addEventListener('calcFields', calculatedFunct);


When i run the movie and try to input numbers into f1 and f2, I get "NULL" in box1.

What am i doing wrong?

Thanks in advance, db

Null Value When Reading From XML
Code:
<Content>
<Multimedia>
<Media format="jpg" filesize="5k" height="50" width="50">
http://example.com/logo.jpg
</Media>
</Multimedia>
</Content>

Code:
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.load("content.xml");
myPhoto.onLoad = function(success) {
if(success){
photo = myPhoto.firstChild.firstChild.firstChild.nodeValue;
trace(photo);
this.loader1.loadMovie(photo);
}
else{
trace('XML not loaded.');
}
}
trace() will show "null"

If I leave off "nodeValue" I get all of the tag:

Code:
<Media format="jpg" filesize="5k" height="50" width="50">
http://example.com/logo.jpg
</Media>
I just want the URL.
Any ideas what I'm doing wrong?

This.onRelease = Null; <--- What?
Hey Guys...I have a doubt to clear, as i'm very weak in AS.
What the use of this function?

this.onRelease = null

&

how to (un) null it?

Thanks in Advanced!

Number As Null
Flex generates a warning if a variable or method typed as :Number contains or returns null.

what should i do if i have, for example, an optional parameter of type :Number, that i want to default to null? or a method that returns a :Number value if all goes well, but if there is some problem in the method body, returns null?

i could pick some arbitrary number to use in the place of null, as a default value or error code, but i don't like that idea; what if i end up needing to use said arbitrary value for some calculation?

basically, i just need a value that can be plugged into a var typed as :Number that has no meaning of its own.

Null In AS3 Compared To AS2?
I have a flash file where I have a button with a mouse event and over it I have a movie clip. In AS2 I would write:

mc = null;

and the movie clip will still be there but I will still be able to interact with my button.

In AS3 this doesn't work, does anyone know how to null an object to still interact with whats underneath?

Volume And Pan Slider On The Null
I have been going over Joe Jabon's volume and pan slider twice, I doublechecked every action I even copied his actionsscripts from his downloaded Fla(how I love these) into my workout movie.

But alas it still does'nt work. Altough when I test the movie from his Fla it works.

I must be doing something wrong but what?
Help somebody!

Variable Not Reading Null - Help Please
Okay, here's the problem.

I have several input text boxes. The user needs to fill in some, and leave others blank. They are judged when the user hits enter. For the text fields that should be left blank, I say that they must be null. This works if the user puts nothing in the field.

If, however, they put something in the field and then backspace or delete the information so that nothing is in the field, it is no longer judged as null.

Is there anyway to judge if a variable is empty if the user types something in a field, but then realizes their mistake and corrects it before hitting enter?

Thanks in advance.

XML Question: NULL Is Displayed...
I'm having a problem displaying the "name" field of my XML. I'm sorting through some XML to find a certain node and then passing it all to my passItOn variable.

When set my dynamic HTML text field equal to "display" it shows this: "NULL P19031"

The "NULL" should be "Magazine File - 2 pk".

What am I missing here? Can I not pull that from a variable?

code__________________

passItOn = <ans_id id="1"><sku no="P19031"><name><a href="http://www.link.com"><u>Magazine File - 2 pk</u></a></name><consumercopy>Need real copy here</consumercopy><featurelist><feature>Feature 1</feature><feature>Feature 2</feature><feature>Feature 3</feature><feature>Feature 4</feature></featurelist><descriptor> decriptors here!</descriptor></sku></ans_id>

display = passItOn.firstChild.firstChild.nodeValue + " " + passItOn.firstChild.attributes.no;

Null Links In Buttons
Hay all you grate coffee drinking guru types.

Can any one help with a problem with anchor jump to links.

What are you trying to do I hear you say??

Well in html you can make some one jump to a pre-defined place on a page the anchor point when they press on a link.

I want to use a flash nav interface to jump to an anchor point on the page.

Calcfields Coming Up NULL
Hi, I'm using flash 2004 professional. I'm trying to make a calculated field in a dataset but am having some trouble.

I've tried to follow the example used in the flash help.
I have a dataset named "ds".
I have 3 input text components called "f1" , "f2" and "box1"

In the ds schema, i've made 3 items -- "price", "quantity" and "totalPrice".

All 3 have datatypes set to Number.
"totalPrice" Kind is set to Calculated.

I have f1 bound(out) to ds.price -- f2 bound(out) to ds.quantity -- and box1 bound(in) to ds.totalPrice.

On the first frame of the movie i have this actionscript:

function calculatedFunct(evt) {
evt.target.totalPrice = (evt.target.price * evt.target.quantity);
}
_root.ds.addEventListener('calcFields', calculatedFunct);


When i run the movie and try to input numbers into f1 and f2, I get "NULL" in box1.

What am i doing wrong?

Thanks in advance, db

Comparisons With Null Or Undefined
I'm not sure if this is a bug or if it reflects some very obscure logic, but I recently learned that undefined and null don't always evaluate the way you'd expect them to.

Try inserting this code into a new fla and test it:


Code:
trace ("for undefined:");
trace ("(undefined >= 0) evaluates to " + (undefined >= 0));
trace ("(undefined > 0) evaluates to " + (undefined > 0));
trace ("(undefined == 0) evaluates to " + (undefined == 0));
trace ("");
trace ("for null:");
trace ("(null >= 0) evaluates to " + (null >= 0));
trace ("(null > 0) evaluates to " + (null > 0));
trace ("(null == 0) evaluates to " + (null == 0));


Here's what it produces:


Code:
for undefined:
(undefined >= 0) evaluates to true
(undefined > 0) evaluates to undefined
(undefined == 0) evaluates to false

for null:
(null >= 0) evaluates to true
(null > 0) evaluates to undefined
(null == 0) evaluates to false


The way I came across it was in an if statement that figured that if a certain variable (of type Number) had been defined, it would necessarily be greater or equal to zero (in my example). But the test
if (theNum >= 0)
would come out true instead of the undefined or NaN I'd expected if theNum was undefined!

(Incidentally, I replaced the code with >= -1 instead, and that worked properly for this case.)

Anyway, I'm not sure if this post is a question or a cautionary tale, but I thought I'd mention this in case anyone had anything to say about it.

Null Object Error
Hi,

Is anyone able to offer some advice on this problem i've got - i dont understand why it's doing it so dont know where to begin to fix it.

I've got a holder swf which loads into it a welcome swf on load up. you can then click on to some buttons which load further swfs - it all goes made at this point and i cant figure out why?

any advice would be much appreciated

thanks

Null Object Using Preloader
I have a swf that is called preloader.swf..All it does is preload my main movie. The code for my preloader is:

PHP Code:




stage.scaleMode = StageScaleMode.NO_SCALE;stage.align = StageAlign.TOP_LEFT;var l:Loader = new Loader();l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);l.load(new URLRequest("content.swf"));function loop(e:ProgressEvent):void{    var perc:Number = e.bytesLoaded / e.bytesTotal;    preloader.txt.text = Math.ceil(perc*100).toString();}function done(e:Event):void{    removeChildAt(0);    preloader.txt = null;    addChild(l);}







and my content.swf contains:

PHP Code:




stage.scaleMode = StageScaleMode.NO_SCALE;stage.align = StageAlign.TOP_LEFT;stage.addEventListener(Event.RESIZE, resizeHandler);function resizeHandler(e:Event):void{    header.width = stage.stageWidth + 100;    bgClip.y = 0;    bgClip.x = 0;    bgClip.width = stage.stageWidth;    bgClip.height = stage.stageHeight;    bgClip.scaleX >  bgClip.scaleY ? bgClip.scaleY = bgClip.scaleX : bgClip.scaleX = bgClip.scaleY;}resizeHandler(null);







I am assuming the null reference is talking about the references to stage. I a mgetting this error:

Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at content_fla::MainTimeline/frame1()

What am I doing wrong here?

Null A Mousemove Function
hi guys,, i have a pencil drawing api

my intention are KILL THE DRAWING API WHEN I HIT SPACE BAR



ON CLIP EVENT

PHP Code:



on (press) {
    _root.window_mc.container_mc.clip3.container.gotoAndStop(7);    
    Mouse.hide();
    this.startDrag(1);
    _root.window_mc.container_mc.clip3.container.cap.gotoAndStop(40);    
}
//HERE I WANT TO KILL THE MOUSEMOVE FUCTION HERE
on (keyPress "<Space>") {    
// DOESNT WORK this.onMouseMove = null;
    Mouse.show();
    this.stopDrag();






DRAWING API


PHP Code:



_root.window_mc.container_mc.clip3.container.pencil_mc.swapDepths(2);

// 1. SETTING THINGS
_root.window_mc.container_mc.clip3.container.createEmptyMovieClip("line",1);

// 2. EVENTS IN _ROOT:
_root.window_mc.container_mc.clip3.container.pencil_mc.onMouseDown = function(){
    //this.quitar = null;
    line.curveTo(_xmouse,_ymouse);
    line.moveTo(_xmouse,_ymouse);
    line.lineStyle(4,0xAE001A,90);
    this.onMouseMove = function(){
        line.lineTo(_xmouse,_ymouse);
        updateAfterEvent();
    }
    
}
_root.window_mc.container_mc.clip3.container.pencil_mc.onMouseUp = function(){
    this.onMouseMove = null;
}

// 3. BUTTON "ERASE":
// --------------------
buttonErase.onPress = function(){
    _root.window_mc.container_mc.clip3.container.line.clear();
}
stop(); 





THANKS FOR ANY SUGGESTION OR HELP

Copyright © 2005-08 www.BigResource.com, All rights reserved