Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

visible property and xml

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
0
0
US
I have an actionscipt enabled movie that worked just fine under CS2 and is now misbehaving under CS4. I have several ornaments on a tree that I want to control the visibility of through XML and ActionScript. Here's the AS:

Code:
import flash.display.*;
import flash.events.*;
import flash.net.*;

	
var decorations:XML = new XML();
var XML_URL:String = "tree.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event:Event):void
{
    decorations = XML(myLoader.data);
    trace("Data loaded.");

// Sets visibility based on XML data.
Star1.visible = decorations.Star1.visible;
Star2.visible = decorations.Star2.visible;
...
Code:
// Sets textbox from XML data for each decoration
Star1.addEventListener(MouseEvent.ROLL_OVER, function(event) {textbox.text = decorations.Star1.dedication.toString();});
Star1.addEventListener(MouseEvent.ROLL_OUT, out);
Star2.addEventListener(MouseEvent.ROLL_OVER, function(event) {textbox.text = decorations.Star2.dedication.toString();});
Star2.addEventListener(MouseEvent.ROLL_OUT, out);
...
Code:
}

function out(evt:MouseEvent):void {
	textbox.text = "";
}
And here's the XML:
Code:
<decorations>
	<Star1>
		<visible>true</visible>
		<dedication></dedication>
	</Star1>
	<Star2>
		<visible>false</visible>
		<dedication></dedication>
	</Star2>
...
Code:
</decorations>

This used to work great, but now all of the ornaments are visible even where their xml-visibility is false. What gives?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top