I have a xml-string(not the xml-file). How can I create a cocos2dx's particle-system by this xml-string? Someone can help me. Thank you very much!!
Asked
Active
Viewed 391 times
2 Answers
0
CCParticleSystem *pRet = new CCParticleSystem();
if(pRet)
{
CCDictionary *dict = CCDictionary::createWithContentsOfFileThreadSafe(xmlString.c_str());
CCAssert( dict != NULL, "Particles: file not found");
pRet->initWithDictionary(dict);
dict->release();
pRet->autorelease();
this->addChild(pRet,100);
}
Hope it will be helpful :)

PeakCoder
- 852
- 8
- 20
-
xmlString is a 'content' but not a 'file name' – minji_LT Jan 07 '13 at 06:02
-
yes, it didn't work. But I have solve this problem. thank you – minji_LT Jan 07 '13 at 07:19
-
@minji_LT Would you like to post your answer? It will help the people who encounters the same problem :) – PeakCoder Jan 07 '13 at 07:36
-
I write a function to parse the xmlContent to a CCDictionary. – minji_LT Jan 07 '13 at 08:52
0
It might easier to use a particle Designer and export the particle System into a plist file and use Spencer Wong's method.

m.ding
- 3,172
- 19
- 27