Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other sprites vanish when you start drawing #117

Open
MrJop opened this issue Jul 30, 2014 · 4 comments
Open

Other sprites vanish when you start drawing #117

MrJop opened this issue Jul 30, 2014 · 4 comments

Comments

@MrJop
Copy link

MrJop commented Jul 30, 2014

So I have this setup inside a Starling Sprite (below are all Starling elements):

a Quad
an Image
an Image
a Shape
5 Buttons

Up to so far everything is ok and everything is visible. But as soon as I start drawing in the Shape, my Buttons and Images all disappear. It looks like they're not completely gone as the buttons still work, I just can't see them.

When I then clear the graphics in the shape, everything returns to normal. It's not a case of the visual inside the Shape blocking things as the Buttons in the higher layers also disappear and I can still see the Quad which is a solid background colour.

Any ideas?

@IonSwitz
Copy link
Member

Nope. Without code to reproduce this, it is very hard to have any idea what could be wrong. The times I have seen similar bugs, the Shape has been incomplete, for example, a fill was used without closing the shape with proper lineTo calls, or similar issues.

Could you please supply the calls you do to the Shape? I will see if I can find another issue where this occured as a reference

@MrJop
Copy link
Author

MrJop commented Aug 1, 2014

Thanks for the quick reply. This is the draw call I'm making:

var g:Graphics = myCanvas.graphics;
g.clear();
g.beginFill(0xff00ff);
g.moveTo(pos.x * pe.physScale, pos.y * pe.physScale);
g.lineTo(pos.x * pe.physScale, pos.y * pe.physScale);
g.lineTo(pos.x * pe.physScale, pos.y * pe.physScale);
g.lineTo(pos.x * pe.physScale, pos.y * pe.physScale);
g.endFill();

@IonSwitz
Copy link
Member

IonSwitz commented Aug 1, 2014

Sorry, but.. that results in a point that might degenerate the math code, and it might even throw an exception. The same vertex points in all vertices?

What are you trying to achieve?

@MrJop
Copy link
Author

MrJop commented Aug 1, 2014

sorry my bad. I took out bits of code before copy pasting it. The drawing works fine. Its just the other elements that are disappearing is the issue. This also happened when I just had a simple drawing application where you move your finger and a line gets drawn. I've copy pasted that code below:

var touch:Touch = e.getTouch(stage);
var position:Point = touch.getLocation(stage);

        switch(touch.phase){
            case TouchPhase.BEGAN:
                //myCanvas.graphics.beginFill(Math.floor(Math.random()*16700000));
                myCanvas.graphics.lineStyle(20, Math.floor(Math.random()*16700000));
                myCanvas.graphics.moveTo(position.x, position.y);
                break;

            case TouchPhase.MOVED:
                myCanvas.graphics.lineTo(position.x, position.y);
                break;

            case TouchPhase.ENDED:
                myCanvas.graphics.endFill();
                break;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants