Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Button tutorial #61

Closed
RichardGale opened this Issue Mar 11, 2014 · 8 comments

Comments

Projects
None yet
3 participants

Does anyone have a tutorial, step-by-step instructions how to build a button in Adobe Flash? This is the content/graphic side of things over hook up in code.

Thanks,
Richard.

Contributor

splhack commented Mar 11, 2014

  1. "Insert" -> "New Symbol"
    screen shot 2014-03-11 at 2 28 42 pm
  2. Type: "Button", Named the symbol
    screen shot 2014-03-11 at 2 29 17 pm
  3. Add a key frame at "Hit" frame
    screen shot 2014-03-11 at 2 29 47 pm
    screen shot 2014-03-11 at 2 29 55 pm
  4. Select rectangle tool
    screen shot 2014-03-11 at 2 30 05 pm
  5. Draw a shape in "Hit" frame
    screen shot 2014-03-11 at 2 30 15 pm
  6. That's it, you can put a button instance from the library.
    screen shot 2014-03-11 at 2 30 52 pm
    screen shot 2014-03-11 at 2 31 00 pm

@splhack splhack closed this Mar 11, 2014

One additional request, can you add to the sample code that reactions to a button being pressed.

Contributor

splhack commented Mar 11, 2014

Please take a look at http://www.cocos2d-x.org/forums/18/topics/40551?r=43216#message-43216

And you can use LWF::AddButtonEventHandler without ActionScript but the instance name for the button required.

// C++11 required for the lines.
lwf->AddButtonEventHandler("FooButtonInstance", {
    {"press", [=](LWF::Button *b){
    },
    {"release", [=](LWF::Button *b){
    },
    {"rollOver", [=](LWF::Button *b){
    },
    {"rollOut", [=](LWF::Button *b){
    },
});

What is the instance name of the button instance. Select the button instance in the stage,
screen shot 2014-03-11 at 4 47 01 pm
screen shot 2014-03-11 at 4 47 35 pm

Contributor

splhack commented Mar 13, 2014

Eh, I noticed two problems. forgot to add lines for changing interactive in LWF::AddButtonEventHandler. swf2lwf.rb failed to extract button script in Flash CC. We'll fix it.

@splhack splhack reopened this Mar 13, 2014

Contributor

splhack commented Mar 13, 2014

Please use the latest LWFS https://github.com/gree/lwfs/releases/latest

  • How to write button action in Flash CC, Write /* as */ action in the frame action panel where the button instance is placed at.
    screen shot 2014-03-12 at 7 26 03 pm
    screen shot 2014-03-12 at 7 26 27 pm
Contributor

splhack commented Mar 13, 2014

LWF::AddButtonEventHandler now set interactive true.

@splhack splhack closed this Mar 13, 2014

Thank you. Great job.

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