how to use AttachLwf #59

irene-coming opened this Issue Feb 27, 2014 · 2 comments


None yet
2 participants

I want to move a movieclip instance from lwf1 to lwf2. The instance is added to the root in A.swf and name it "myMC".
I tried the following code :
auto lwf1 = LWFNode::create("1.lwf");
auto lwf2 = LWFNode::create("2.lwf");
LWF::Movie *mc = lwf1->lwf->SearchMovieInstance("myMC");
mc->AttachLWF(lwf2->lwf, "attachNm");

mc turns out to be null.
If I replace "myMC" with "root", mc is not null, but has no any effect change to lwf2.


splhack commented Feb 27, 2014

In Cocos2d-x, use LWFNode::attachLWF API.
For example, want to attach A.swf into targetA movie in Base.swf,

auto baseLWFNode = LWFNode::create("Base.lwf");
baseLWFNode->lwf->AddMovieEventHandler("targetA", {{"load", [=](LWF::Movie *m){
    baseLWFNode->attachLWF("A.lwf", "targetA" /* targetName */, "A" /* attachName */);

Thank a lot.

@splhack splhack closed this Feb 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment