添加Imagebutton接口
function AddButton( png1, png2, menu, pos, fun, target, tag, zorder )
if( tag == nil ) then tag = 0; end
if( zorder == nil ) then zorder = 0; end
if( tag ~= 0 and menu:getChildByTag(tag) ) then
menu:removeChildByTag( tag, true );
end
local button = ImageButton:create( png1, png2, nil, target );
if( button == nil ) then return nil; end
menu:addChild( button, zorder, tag );
button:setPosition( pos );
button:registerScriptTapHandler( fun );
return button;
end
EX:
AddButton("p_btn_inner_red.png", "p_btn_inner_red_down.png",menu,ccp(80,14.5),
function ()
end,
father, Tag.Btn
)