Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Cocos Creator JavaScript the callback function of cc.resources.load not work

I used cc.resources.load() and modify the value of parameter in properties, but it doesn't work when I read the value of parameter out of callback function. Is there anybody who can help me, thanks!!!!The language is JavaScript. enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!