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!

change movieclip alpha based on xml variable

Status
Not open for further replies.

cr84net2

Programmer
Feb 8, 2005
93
US
I have an swf that plays a video (toobplayer component) and has two dynamic txt fields. The video and both txt fields are "fed" from an xml file. I also have a movie clip that loads an image on another layer and is set to an alpha of 0. Is there a way to use a conditional statement to check the video variable and if one is not present to change the image loading movieclip to an alpha of 100. here is what I am working with.

Code:
var configXML:XML = new XML();

loadConfig = function(xmlFile:String) {
  var scope = this;
  
  configXML.ignoreWhite = true;
  configXML.load(xmlFile);
  configXML.onLoad = function(success) {
    if(success) {
      scope.initApplication();
    } else {
      trace("Error loading XML file ("+xmlFile+")");
    }
  }
}

getConfigParam = function(param:String) {
  var tmp = configXML["idMap"][param];
  if(tmp == undefined) {
    tmp = this[param];
  } else {
		tmp = tmp.attributes["value"];
	}
  return tmp;
}

initApplication = function() {
	var tagName2:String = getConfigParam("tagName2");
	var tagCon2:String = getConfigParam("tagCon2");
    var vidpath = getConfigParam("videoFile2");
	var imgName1:String = getConfigParam("imgName1");
	imgName_mc._target= imgName1;
	tagName_txt.htmlText = tagName2;
	tagCon_txt.htmlText = tagCon2;
	videoPlayer_vid.url = vidpath;
	  loadVideo();
  
}



loadVideo = function() {
  var vid_nc:NetConnection = new NetConnection();
  vid_nc.connect(null);
  var vid_ns:NetStream = new NetStream(vid_nc);
  videoPlayer_vid.attachVideo(vid_ns);
  vid_ns.play(getConfigParam("videoFile2"));
}

If (vidpath.value == undefined); {

	imgName_mc.alpha= 100;
	loadClip();
}

loadConfig("xml/config.xml");

The video and dynamic text fields work fine as long parameters are available in the xml. However i am not having any luck with changing the alpha of the image movie clip if no video parameters are avaiable. i have tried

return (vidpath.length > 0); Then setting the alpha to 100
Also
return (vidpath.value == 0); Then setting the alpha to 100

without any luck. I am using Flash 8 and do not have much experience with it. I have been reading and trying different methods to get here.

Any help would be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top