Hi, I’m trying to run a Spawn and a Scale action within a lambda but Lamda doesn’t copy theirs value at all. In the below code, I have a defined onSelectedSpawn
, which is a Spawn. mSetting
and mFamilyTV
are MenuItemImage. what I am doing wrong? Your help is very much appriciated
auto fadeIn = FadeTo::create(0.5f, 255);
auto scaleIn = ScaleBy::create(0.5f, 1.4f);
auto onSelectedSpawn = Spawn::createWithTwoActions(fadeIn, scaleIn);
// This run without any problem
mSetting->runAction(onSelectedSpawn);
mFamilyTV = MenuItemImage::create("en_block5.png", "en_block5_hover.png",
[=](cocos2d::Ref* pSender){
//Running Spawn makes app crashed because the lambda couldn't copy onSelectedSpawn's value
mFamilyTV->runAction(onSelectedSpawn);
//Running Scale action make app crashed too. It also doesn't copy scaleIn at all
mFamilyTV->runAction(scaleIn);
});