Can't create cc.ProgressTimer instance in Cocos Creator project

Hello!

This article says, ProgressTimer preserved it’s behavior:
http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/getting-started/cocos2d-x-guide/

So, I tried to create ProgressTimer from code with both:

var obj1 = new cc.ProgressTimer(sprite); // -> cc.ProgressTimer is not a constructor

and

var obj2 = cc.ProgressTimer.create(sprite); // -> Cannot read property ‘create’ of undefined

code lines and as you see nothing is working for me.

I’m using Cocos Creator 1.4.
Why can’t I successfully do it?

I can’t even find CCProgressTimer.js inside CocosCreator directory.
Also, I can’t find CCClippingNode.js(which is listed in preserved nodes list on Cocos Creator docs). But there is still CCSprite.js file presented. What am I missed up?

Hi @prouser

May I ask, what are you trying to accomplish, by any chance are you referring to cc.ProgressBar? God Bless…

Sincerely,

Sunday

Thanks for your reply!

I know about cc.ProgressBar and I’m already using it without any sort of problems.
But I need cc.ProgressTimer to create a sort of radial progress bar like this:

There are a lot of examples how to achieve it using cc.ProgressTimer, but they still does not work for me in Cocos Creator.

There is no cc.ProgressTimer in Creator, but what you show here can be achieved with cc.ProgressBar - you just need to change bar sprite’s fillType property to radial

persy, thanks for your answer!

Now I’m trying to to do what I want with cc.ProgressBar as you said.
I set RADIAL fill type to both ProgressBar’s sprite and to it’s inner node, called “bar” by default.

// progress bar's sprite    
let progressBarSprite = this.ProgressBar.getComponent('cc.Sprite');
progressBarSprite.fillType = cc.Sprite.FillType.RADIAL;

// inner progress bar's sprite
this.ProgressBarSprite.fillType = cc.Sprite.FillType.RADIAL;
this.ProgressBar.progress = 0.5;

What I got is usual ProgressBar behavior:

(I made width == height and set progress to 0.5 and looks like nothing changed)

UPDATE: I found, that fillType works only with this.ProgressBarSprite.type = cc.Sprite.Type.Filled;

But now I’ve got an error:

“Can not generate quad”

Finally, I got correct behavior on standalone sprite(it does not belong to progress bar):

this.ProgressBarSprite.type = cc.Sprite.Type.FILLED;
this.ProgressBarSprite.fillType = cc.Sprite.FillType.RADIAL;
this.ProgressBarSprite.fillCenter = new cc.Vec2(0.5, 0.5);
this.ProgressBarSprite.fillStart = 0.25;
this.ProgressBarSprite.fillRange = 0.625;

Code mentioned above leads to this result:

Last question: how to manage sprite with such behavior from code, using ProgressBar’s “progress” property?

OMG, that was sooo simple… After changing type to FILLED in editor - all became clear. Problem is that by default FILLED leads to empty sprite which shows nothing and that scared me a bit, I even did not look at additional settings offered by FILLED mode and tried to do all by my own from code.

I’m sorry for such a silly question :frowning:

Great Project Thanks For Sharing Information

Please insert a image, i have difficulty with this