flash不播放 求高手不在帧上写代码 做as3.0的进度条代码 20
package{importflash.display.Loader;importflash.display.Sprite;importflash.events.Even...
package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
public class LoaderFriut extends Sprite
{
private var progressbar:Sprite;
private var _width:int;
private var _text:TextField;
private var _loader:Loader;
private var _progressbar:Sprite
public function LoaderFriut()
{
trace(123132);
this.graphics.beginFill(0x000000);
this.graphics.drawRect(100,200,300,22);
this.graphics.endFill();
var f:TextFormat=new TextFormat();
f.color=0xFF0000;
f.font="华文彩云";
f.bold=true;
f.blockIndent=5;
f.size=15;
_text=new TextField()
_text.type=TextFieldType.DYNAMIC;
_text.setTextFormat(f);
_text.x=403;
_text.y=201;
_text.textColor=0xFF0000;
_loader=new Loader();
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,drawProgess);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderOver)
_loader.load(new URLRequest("Friut.swf"));
}
private function drawProgess(evt:ProgressEvent):void{
this._progressbar = new Sprite();
this._progressbar.graphics.beginFill(0xFF0000);
var width:int=Math.round((evt.bytesLoaded/evt.bytesTotal)*300);
trace(width);
trace("你好 我现在 好像 可以监听进度"+evt.bytesLoaded+" "+evt.bytesTotal);
this._progressbar.graphics.drawRect(100,201,width,20);
this.addChild(this._progressbar);
this._text.text=evt.bytesLoaded*100/evt.bytesTotal+"%";
this.addChild(_text);
}
private function loaderOver(evt:Event):void{
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS,drawProgess);
this.loaderInfo.removeEventListener(Event.COMPLETE,loaderOver);
this.addChild(_loader);
}
}
}
我的代码执行后 没有播放Friut flash文件 展开
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
public class LoaderFriut extends Sprite
{
private var progressbar:Sprite;
private var _width:int;
private var _text:TextField;
private var _loader:Loader;
private var _progressbar:Sprite
public function LoaderFriut()
{
trace(123132);
this.graphics.beginFill(0x000000);
this.graphics.drawRect(100,200,300,22);
this.graphics.endFill();
var f:TextFormat=new TextFormat();
f.color=0xFF0000;
f.font="华文彩云";
f.bold=true;
f.blockIndent=5;
f.size=15;
_text=new TextField()
_text.type=TextFieldType.DYNAMIC;
_text.setTextFormat(f);
_text.x=403;
_text.y=201;
_text.textColor=0xFF0000;
_loader=new Loader();
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,drawProgess);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderOver)
_loader.load(new URLRequest("Friut.swf"));
}
private function drawProgess(evt:ProgressEvent):void{
this._progressbar = new Sprite();
this._progressbar.graphics.beginFill(0xFF0000);
var width:int=Math.round((evt.bytesLoaded/evt.bytesTotal)*300);
trace(width);
trace("你好 我现在 好像 可以监听进度"+evt.bytesLoaded+" "+evt.bytesTotal);
this._progressbar.graphics.drawRect(100,201,width,20);
this.addChild(this._progressbar);
this._text.text=evt.bytesLoaded*100/evt.bytesTotal+"%";
this.addChild(_text);
}
private function loaderOver(evt:Event):void{
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS,drawProgess);
this.loaderInfo.removeEventListener(Event.COMPLETE,loaderOver);
this.addChild(_loader);
}
}
}
我的代码执行后 没有播放Friut flash文件 展开
展开全部
if(_loader.content == null)
{
loadprogress is wrong;
}else
{
try(MovieClip(_loadr.content).play())
catch(e:Error)
{
try(other Elements eg:the fruit.swf )
catch (e:Error)
{
i dont know what is wrong with your app.
}
}
}
{
loadprogress is wrong;
}else
{
try(MovieClip(_loadr.content).play())
catch(e:Error)
{
try(other Elements eg:the fruit.swf )
catch (e:Error)
{
i dont know what is wrong with your app.
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询