Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17070

"Invalid Native Object" when running cc.animate( animation )

$
0
0

@gadapchetvoi wrote:

Does anyone have any idea about my code & error? (please help @pandamicro)

What I'm trying to do: from a serie of png images, I want to make animation that play them as movie.

My code:

pngToSFrame: function(pngUrl){
     var url = cc.url.raw('resources/'+pngUrl);
     var texture = cc.textureCache.addImage(url);
     texture.setAliasTexParameters(); /*Disable anti-alias*/
     return new cc.SpriteFrame(texture);
},

onLoad: function(){
    var f1 = this.pngToSFrame('terrain/animCoin.png');
    f1.retain();
    var f2 = this.pngToSFrame('terrain/animCoin1.png');
    f2.retain();

    var frameArr = [f1, f2];
    var animation = new cc.Animation(frameArr,2,20);
    //animation.retain();      //-- cause error: animation.retain is not a function

    var action = new cc.Animate(animation);    // -- THIS LINE CAUSES ERROR
    action.retain();
    this.runAction(action);
}

The error simulator gave me:

Simulator: jsb ERROR: File ..\auto\jsb_cocos2dx_auto.cpp: Line: 19086, Function: js_cocos2dx_Animate_initWithAnimation
Simulator: Invalid Native Object
Simulator: C:/CocosCreator/resources/cocos2d-x/simulator/win32//script/jsb_create_apis.js:693:Error: Invalid Native Object

Thank you all!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17070

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>