Question : Actionscript: show system cursor when XML attribute is blank or null

Hi there,

I've created a photo gallery using Flash and calling the images/attributes from an XML file. There is a link attribute that will sometimes be blank. Currently the hand cursor appears with or without a link attribute. The client would like just the system arrow cursor to show when the link is blank.

I'm missing something in my if statement for this. Any help would be appreciated.

Here is what the XML looks like:


http://www.okbu.edu" title="Title/photo caption goes in this area." />







The full AS for this part of the project is attached below. I assume this is where the problem is:
target_mc.onRelease = function() {
           if( _root.FullImageLink != "" && _root.FullImageLink != null )
           {   // If the link is not blank or null, then load it; otherwise, do nothing
                getURL(_root.FullImageLink);
           }
               if( _root.FullImageLink == "" && _root.FullImageLink == null )
               {useHandCursor = false;}
        };

Thank you!
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
////Listener for fullImage_mc
var fClip = new Object();
fClip.onLoadInit = function(target_mc:MovieClip) {
        target_mc.onRelease = function() {
                getURL(_root.FullImageLink);
        };
 
};
function callFullImage(myNumber) {
        myURL = myImages[myNumber].attributes.full_url;
		myTitle = myImages[myNumber].attributes.title;
        _root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
        fullImage_mc._x = _root.full_x;
        fullImage_mc._y = _root.full_y;
        ////store the link from XML in _root.FullImageLink
        _root.FullImageLink = myImages[myNumber].attributes.thelink;
        ////////////////////////////////////////////////////
		target_mc.onRelease = function() {
           if( _root.FullImageLink != "" && _root.FullImageLink != null )
           {   // If the link is not blank or null, then load it; otherwise, do nothing
                getURL(_root.FullImageLink);
           }
		   if( _root.FullImageLink == "" && _root.FullImageLink == null )
		   {useHandCursor = false;}
        };
        var fullClipLoader = new MovieClipLoader();
		var fullPreloader = new Object();
		fullClipLoader.addListener(fullPreloader);
        
		var myCaption:TextFormat = new TextFormat();
		myCaption.size=10;
		myCaption.font= "Arial";
		myCaption.align= "center";
		
		fullClipLoader.addListener(fClip);
        
		fullPreloader.onLoadStart = function(target) {
		target.createTextField("my_txt",target.getNextHighestDepth,0,301,186,50);
		target.my_txt.selectable = false;
		target.my_txt.wordWrap = true;
		target.my_txt.setNewTextFormat(myCaption);
		};
		
		 fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
		target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
		};
		
		fullPreloader.onLoadComplete = function(target) {
		target.my_txt.text = myTitle;
		};
		
		
		
		fullClipLoader.loadClip("photos_full/"+myURL,fullImage_mc); 
}
Open in New Window Select All

Answer : Actionscript: show system cursor when XML attribute is blank or null

ok found your problem.
see code snippet
the onRelease event was being added to each item irrespective, which by default gets the handcursor, so check if it has a link first before assigning the handler.

blu.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
if (_root.FullImageLink != "" && _root.FullImageLink != null)
	{
		target_mc.onRelease = function()
		{
			getURL(_root.FullImageLink);
		};
	} else
	{
		trace("in the else with "+this);
		target_mc.useHandCursor = false;
 
	}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us