<?php include("sample_utils.php"); // provides some utils and using mk $swfFN = "btarea.swf"; // swf file name to ouput $shape1 = new MKshape_container(); // a shape ... $shape1->add_fillStyle_solid(); // ... with default black color $shape1->add_rect(); // ... and a 100x100 default rect $shapeTD1 = $shape1->update_tagData(); // get tag data $button1 = new MKbutton_container("", 2); // a button $buttonTD1 = $button1->build_button_state($shape1, "hit"); // with only "hit" state $buttonPB1 = $button1->update_place_tagData(); // place tag data $swf = new MKswf($swfFN); // the swf to generate $swf->set_swfDir(SERVER_MKTMP); // set output directory $swf->add_tagData($shapeTD1); // start to populate $swf->add_tagData($buttonTD1); // ... $swf->add_tagData($buttonPB1); // ... $swf->swf_output(); $swfHeader = $swf->fetch_assoc(); // prepare to publish to the browser $str = "<div style=\"width:600; height:500; background-color:#EEEEEE; text-align:center\"><br />"; $str .= render_swf_box($swfHeader, $imgDir, false); $str .= "<br/><strong>" .$swfFN ." created in :<br />" .SERVER_MKTMP ."</strong>"; $str .= "<br/>hit area is in the top left until 100,100</div>"; ?>
building "hit area" button is simple. All you have to do is define a shape drawn with desired form and the use call build_button_state method for MKbutton_container.
buttons in mk can be stored as linkage symbols in the same way of movieclips, sounds and fonts. E.g. you can store a 100x100px (default shape rectangle) and use it at run-time playing with its _xscale and _yscale to create smaller or larger transparent hit areas.
![]()