We help IT Professionals succeed at work.

flash error "TypeError: Error #1085: The element type..." from XML

omejan
omejan asked
on
3,455 Views
Last Modified: 2013-11-11
I am pulling my hair out for days.
I have created a flash movie using xml from wheather.com.
If i run the movie from my desktop it works fine.
After placing it on my webserver and using proxy.php to call the xml file.
I get the following error:
TypeError: Error #1085: The element type "IMG" must be terminated by the matching end-tag "</IMG>".
      at Weather_Widget_5_day_fla::MainTimeline/weatherLoaded()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()

The actionscript is fine, the xml has been validated using a xml validator.
The tag </img> can not even be found in the xml.

Like I said running it from my desktop no problem.
Does anyone know what the problem can be?
The code that I am using is below and I am using proxy.php (http://sourceforge.net/projects/php-proxy/).

Thanks in advance
stop();

//=================
//allow domains
//=================

Security.allowDomain("*", "xoap.weather.com");

//=================
//ini settings
//=================

icons_mc.visible = false;

//=================
//XML
//=================

var weather_xml_url:String = "http://www.picsfromtheblue.com/duikschool/URLproxyServer.php?url=http://xoap.weather.com/weather/local/"+city+"?cc=*&dayf=5&link=xoap&par="+par_id+"&key="+key+"&unit="+units;

var weather:XML = new XML();
var weather_url:URLRequest = new URLRequest(weather_xml_url);
var weatherLoader:URLLoader = new URLLoader(weather_url);

weatherLoader.addEventListener(Event.COMPLETE, weatherLoaded);

function weatherLoaded(e:Event):void
{
	weather = XML(weatherLoader.data);
	temp_txt.text = weather.cc.tmp;
	day2_txt.text = weather.dayf.day[1].hi;
	day3_txt.text = weather.dayf.day[2].hi;
	day4_txt.text = weather.dayf.day[3].hi;
	day5_txt.text = weather.dayf.day[4].hi;
	text2_txt.text = weather.dayf.day[1].attribute("t");
	text3_txt.text = weather.dayf.day[2].attribute("t");
	text4_txt.text = weather.dayf.day[3].attribute("t");
	text5_txt.text = weather.dayf.day[4].attribute("t");

	icons_mc.visible = true;

	var weather_icon:int = Number(weather.cc.icon.toString())+1;
	var weather2_icon:int = Number(weather.dayf.day[1].part[0].icon.toString())+1;
	var weather3_icon:int = Number(weather.dayf.day[2].part[0].icon.toString())+1;
	var weather4_icon:int = Number(weather.dayf.day[3].part[0].icon.toString())+1;
	var weather5_icon:int = Number(weather.dayf.day[4].part[0].icon.toString())+1;
	icons_mc.gotoAndStop(weather_icon);
	day2_mc.gotoAndStop(weather2_icon);
	day3_mc.gotoAndStop(weather3_icon);
	day4_mc.gotoAndStop(weather4_icon);
	day5_mc.gotoAndStop(weather5_icon);

	//set the complementary text
	var ud:String = weather.head.ud;
	var us:String = weather.head.us;
	
	var city:String = weather.loc.dnam;
	var time:String = weather.loc.tm;
	var temp:String = weather.cc.tmp;
	var day2:String = weather.dayf.day[1].hi;
	var day3:String = weather.dayf.day[2].hi;
	var day4:String = weather.dayf.day[3].hi;
	var day5:String = weather.dayf.day[4].hi;
	var text2:String = weather.dayf.day[1].attribute("t");
	var text3:String = weather.dayf.day[2].attribute("t");
	var text4:String = weather.dayf.day[3].attribute("t");
	var text5:String = weather.dayf.day[4].attribute("t");
	var flik:String = weather.cc.flik;
	var term:String;

	if (temp == flik)
	{
		term = "and it feels like "+flik+" degrees,";
	} else {
		term = "but it feels like "+flik+" degrees,";
	}
	
	var wind_v:String = weather.cc.wind.s;
	var wind_gust:String = weather.cc.wind.gust;
	var wind_d:String = weather.cc.wind.d;
	var wind_t:String = weather.cc.wind.t;

	var hmid:String = weather.cc.hmid;
	var vis:String = weather.cc.vis;

	info_txt.text = city;
	day2_txt.text = day2;
	day3_txt.text = day3;
	day4_txt.text = day4;
	day5_txt.text = day5;
	text2_txt.text = text2;
	text3_txt.text = text3;
	text4_txt.text = text4;
	text5_txt.text = text5;
}

Open in new window

Comment
Watch Question

Post the values you are using to crate the URL string.

Commented:
I think your problem is in the weather_xml_url variable

Commented:
There is a source forge image embedded  in the link.

Author

Commented:
Hi mizilla,
Thanks for your quick response.
Which link are talking about?

Commented:
weather_xml_url variable =

http://www.picsfromtheblue.com/duikschool/URLproxyServer.php?url=http://xoap.weather.com/weather/local/"+city+"?cc=*&dayf=5&link=xoap&par="+par_id+"&key="+key+"&unit="+units
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.