出现这个问题还有另外一个原因,用TXT格式打开XML文件,旦告早在另友州存为的对话框,编码改为 utf-8 应该就差不多了模雀
1. xml文件,<哪悔root><video>
<url>xxx<url>
</video>
</root>
2.Flash中加载xml。
package {
import flash.display.MovieClip
import flash.net.URLLoader
import flash.events.Event
import flash.net.URLRequest
public class Weather extends MovieClip {
private var xmlloader:URLLoader
private var xml:XML
private var videourl:String
private var rand:Number = Math.random()
private var urlweather:String = "http://flash.weather.com.cn/xml/upload.xml?rand="+rand"
//private var urlweather:String = "upload.xml"
public function Weather() {
xmlloader = new URLLoader()
xmlloader.load(new URLRequest(urlweather))
xmlloader.addEventListener(Event.COMPLETE,onCompleteXml)
}
private function onCompleteXml(e:Event):void
{
xml = XML(e.target.data)
/ /trace(xml)
var xmllist:XMLList = xml.elements()
var lengths:int = xmllist.length()
videourl = xmllist[0].url; //
}
}
// 视屏代码、
videoSprite = new Sprite()
movieObj = new Object()
netConnection = new NetConnection()
netConnection.connect(null)
netStream = new NetStream(netConnection)
customClient= {onMetaData:metaDataHandler}
netStream.client = customClient
netStream.play(videourl) //此videourl变量xml中的视屏路径地址。
netStream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler)
video = new Video(598,336)
video.attachNetStream(netStream)
videoSprite.addChild(video)
this.addChild(videoSprite)
}
关于视屏薯野的各种控制我就不写数缓喊了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)