flash as3.0 能不能把网页加载进来?
展开全部
可以。但是之支持一部分标签
package
{
import flash.display.*;
import flash.text.*;
import flash.events.*
import flash.net.*;
public class HTMLLoadingExample extends Sprite
{
private var _output:TextField;
public function HTMLLoadingExample( )
{
initializeOutput( );
loadData( );
}
private function initializeOutput( ):void
{
_output = new TextField( );
_output.width = stage.stageWidth;
_output.height = stage.stageHeight;
_output.html = true; // Enable HTML for the text field
addChild( _output );
}
private function loadData( ):void
{
var loader:URLLoader = new URLLoader( );
loader.dataFormat = DataFormat.TEXT;
loader.addEventListener( Event.COMPLETE, handleComplete );
loader.load( new URLRequest( "example.html" ) );
}
private function handleComplete( event:Event ):void
{
var loader:URLLoader = URLLoader( event.target );
_output.htmlText = loader.data;
//以html格式显示文本(flash中只支持一部分标签)
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询