'Cocos Creator JavaScript the callback function of cc.resources.load not work
Solution 1:[1]
The problem is the second console.log
is executed right after resources.load
is called, but the first log is asynchronous when loaded. It may take 0.1s, 1s, or more.
The correct program order is:
1. this.voicePool = []
2. cc.resources.load
3. console.log(this.test.duration);(the second one in your screenshot)
4.(a few moment later) function(err,assets){
self.test = assets
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sakiM |