Egret社区
5银子
this.progressBar.value = `Loading...${current}/${total}`;


最佳答案

查看完整内容

难道不是用 parseInt 吗
分享到 :
0 人收藏

14 个回复

倒序浏览
缺失の爱  圆转纯熟 | 2016-9-5 16:34:04
难道不是用 parseInt 吗
sugus  炉火纯青 | 2016-9-5 16:51:28
又是你?
sugus  炉火纯青 | 2016-9-5 16:51:44
private createView():void {          let bg:egret.Shape = new egret.Shape;         bg.graphics.beginFill(0x011c42, 1);         bg.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);         bg.graphics.endFill();           this.textField = new egret.TextField();         this.textField.width = 300;         this.textField.height = 30;         this.textField.size = 18;         this.textField.textColor = 0xcccccc;         this.textField.textAlign = egret.HorizontalAlign.CENTER;         this.textField.verticalAlign = egret.VerticalAlign.MIDDLE;         this.textField.blendMode = egret.BlendMode.ADD;          this.textField.anchorOffsetX = this.textField.width / 2;         this.textField.anchorOffsetY = this.textField.height / 2;          this.textField.y = this.stage.stageHeight * .65;         this.textField.x = this.stage.stageWidth / 2;         this.textField.alpha = 0;          let progressBox:egret.DisplayObjectContainer = new egret.DisplayObjectContainer;         this.progressBox = progressBox;         progressBox.width = 300;         progressBox.height = 20;         progressBox.anchorOffsetX = progressBox.width / 2;         progressBox.anchorOffsetY = progressBox.height / 2;         progressBox.x = this.stage.stageWidth / 2;         progressBox.y = this.stage.stageHeight * .65;          let progressBg:egret.Shape = new egret.Shape;         progressBg.graphics.beginFill(0x000000, .5);         progressBg.graphics.drawRect(0, 0, progressBox.width, progressBox.height);         progressBg.graphics.endFill();           let progress:egret.Shape = new egret.Shape;         progress.graphics.beginFill(0xA9D568, 1);         progress.graphics.drawRect(0, 0, 1, progressBox.height);         progress.graphics.endFill();         this.progress = progress;          progressBox.addChild(progressBg);         progressBox.addChild(progress);           this.addChildAt(bg, -1);         this.addChild(progressBox);         this.addChild(this.textField);       }      private progress:egret.Shape = null;     private progressBox:egret.DisplayObjectContainer = null;      public setProgress(current, total):void {         this.progress.graphics.clear();         this.progress.graphics.beginFill(0xA9D568, 1);         this.progress.graphics.drawRect(0, 0, current / total * this.progressBox.width, this.progressBox.height);         this.progress.graphics.endFill();          this.textField.text = "Loading..." + current + "/" + total;     }
sugus  炉火纯青 | 2016-9-5 16:51:47
private createView():void {          let bg:egret.Shape = new egret.Shape;         bg.graphics.beginFill(0x011c42, 1);         bg.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);         bg.graphics.endFill();           this.textField = new egret.TextField();         this.textField.width = 300;         this.textField.height = 30;         this.textField.size = 18;         this.textField.textColor = 0xcccccc;         this.textField.textAlign = egret.HorizontalAlign.CENTER;         this.textField.verticalAlign = egret.VerticalAlign.MIDDLE;         this.textField.blendMode = egret.BlendMode.ADD;          this.textField.anchorOffsetX = this.textField.width / 2;         this.textField.anchorOffsetY = this.textField.height / 2;          this.textField.y = this.stage.stageHeight * .65;         this.textField.x = this.stage.stageWidth / 2;         this.textField.alpha = 0;          let progressBox:egret.DisplayObjectContainer = new egret.DisplayObjectContainer;         this.progressBox = progressBox;         progressBox.width = 300;         progressBox.height = 20;         progressBox.anchorOffsetX = progressBox.width / 2;         progressBox.anchorOffsetY = progressBox.height / 2;         progressBox.x = this.stage.stageWidth / 2;         progressBox.y = this.stage.stageHeight * .65;          let progressBg:egret.Shape = new egret.Shape;         progressBg.graphics.beginFill(0x000000, .5);         progressBg.graphics.drawRect(0, 0, progressBox.width, progressBox.height);         progressBg.graphics.endFill();           let progress:egret.Shape = new egret.Shape;         progress.graphics.beginFill(0xA9D568, 1);         progress.graphics.drawRect(0, 0, 1, progressBox.height);         progress.graphics.endFill();         this.progress = progress;          progressBox.addChild(progressBg);         progressBox.addChild(progress);           this.addChildAt(bg, -1);         this.addChild(progressBox);         this.addChild(this.textField);       }      private progress:egret.Shape = null;     private progressBox:egret.DisplayObjectContainer = null;      public setProgress(current, total):void {         this.progress.graphics.clear();         this.progress.graphics.beginFill(0xA9D568, 1);         this.progress.graphics.drawRect(0, 0, current / total * this.progressBox.width, this.progressBox.height);         this.progress.graphics.endFill();          this.textField.text = "Loading..." + current + "/" + total;     }
1051822430  圆转纯熟 | 2016-9-5 16:59:27
sugus 发表于 2016-9-5 16:51
private createView():void {          let bg:egret.Shape = new egret.Shape;         bg.graphics.begin ...

不要用textField,能用ProgressBar举个例子吗?或者举个简单的类型转换的例子
1051822430  圆转纯熟 | 2016-9-5 17:22:18
缺失の爱 发表于 2016-9-5 17:14
难道不是用 parseInt 吗

我试一下哈
knight100lv  登堂入室 | 2016-9-5 17:41:02
我一般用的Number(numStr)和num+""
Fishman  登堂入室 | 2016-9-5 22:43:14
借这个问题顺便问下路过的大婶,js的parseInt可以指定进制不?比如parseInt("ff", 16)得到255
muyi  登堂入室 | 2016-9-6 10:22:09
Number()   String()
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|京网文[2014]0791-191号|京ICP证150115号|Egret社区 ( 京ICP备14025619号 )

Powered by Discuz! X3.4 © 2001-2019 Comsenz Inc.

返回顶部