You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 14, 2023. It is now read-only.
Hi Ive tested some of your sample but it does not work with cocoonjs ? when I touch the button , cocoonjs will return error touchstart node.ownerdocument [undefined].
This is my codes. (basically I just use ur demo and mixed it up with actor as button). When click with mouse it is working but when I zip it and put into cocoonjs it wont work....
function createButton(director, rotated) {
var actor = new CAAT.Foundation.Actor().
setSize(60, 60).
centerAt(director.width - 40, director.height - 40);
function createPattern(director, color) {
var actor = new CAAT.Foundation.Actor().
setSize(director.width, director.height).
enableEvents(false);
actor.paint = function (director, time) {
var i, j, ctx;
ctx = director.ctx;
ctx.beginPath();
for (j = 0.5; j < director.width; j += 20) {
ctx.moveTo(j, 0);
ctx.lineTo(j, director.height);
}
for (i = 0.5; i < director.height; i += 20) {
ctx.moveTo(0, i);
ctx.lineTo(director.width, i);
}
ctx.strokeStyle = color;
ctx.stroke();
};
return actor;
}
function _scene1(director) {
var ci= new CAAT.Foundation.SpriteImage().initialize(
director.getImage('botones'), 7, 3 );
var scene1 = director.createScene();
scene1.addChild(createPattern(director, '#33f'));
scene1.addChild(createNumber(director, 1, '#33f'));
var button = createButton(director, false);
button.mouseClick = function (e) {
director.switchToNextScene(
2000,
false,
true
)
}
var b1 = new CAAT.Foundation.Actor().setAsButton(ci.getRef(), 0, 1, 2, 0, function (button) {
director.switchToNextScene(
2000,
false,
true
)
}).setLocation(0, 30);
var container1 = new CAAT.ActorContainer().setBounds(0, 0, director.width, director.height);
container1.addChild(b1);
container1.addChild(button);
scene1.addChild(container1);
var scene2 = director.createScene();
scene2.addChild(createPattern(director, '#f33'));
scene2.addChild(createNumber(director, 2, '#f33'));
var button2 = createButton(director, true);
button2.mouseClick = function (e) {
director.switchToPrevScene(
2000,
false,
true
)
}
var b2 = new CAAT.Foundation.Actor().setAsButton(ci.getRef(), 0, 1, 2, 0, function (button) {
director.switchToPrevScene(
2000,
false,
true
)
}).setLocation(0, 30);
var container2 = new CAAT.ActorContainer().setBounds(0, 0, director.width, director.height);
container2.addChild(b2);
container2.addChild(button2);
scene2.addChild(container2);
CAAT.loop(60);
}
The text was updated successfully, but these errors were encountered:
I don't know if this is related, but when using touch input the button reacts (executes the associated function) but does not get depressed. I mean, there's no visual feedback on a button click. I know that using touch a "hover" functionality like when using a mouse is not possible, but at least a feedback on a successful "click" would be nice.
Was this functionality present before and is the absence of it related to this bug, or should we add this functionality ourselves?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi Ive tested some of your sample but it does not work with cocoonjs ? when I touch the button , cocoonjs will return error touchstart node.ownerdocument [undefined].
This is my codes. (basically I just use ur demo and mixed it up with actor as button). When click with mouse it is working but when I zip it and put into cocoonjs it wont work....
window.addEventListener('load', function(){
CAAT.Module.Initialization.Template.init(800,500,"_c1",
[ {id:"botones",url:"images/botones.png"}
],_scene1
);
}, false);
function createNumber(director, n, color) {
var actor = new CAAT.Foundation.UI.TextActor().
setFont("140px Lucida-sans").
setText("Scene " + n).
calcTextSize(director).
setAlign("center").
setTextFillStyle(color).
setOutline(true).
cacheAsBitmap().
enableEvents(false).
addBehavior(
new CAAT.Behavior.RotateBehavior().
setFrameTime(0, 20000).
setValues(0, 2 * Math.PI).
setCycle(true));
}
function createButton(director, rotated) {
var actor = new CAAT.Foundation.Actor().
setSize(60, 60).
centerAt(director.width - 40, director.height - 40);
}
function createPattern(director, color) {
var actor = new CAAT.Foundation.Actor().
setSize(director.width, director.height).
enableEvents(false);
actor.paint = function (director, time) {
}
function _scene1(director) {
var ci= new CAAT.Foundation.SpriteImage().initialize(
director.getImage('botones'), 7, 3 );
}
The text was updated successfully, but these errors were encountered: