Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm currently working on a game in ActionScript 3 (using FlashPunk) and due to FP's limitation in handling input (~, ^, ã and so on) I ended up having to use AS 3's native TextField class. Through that I capture text, send it to one of my entities in FlashPunk and have it render the text as a graphic (for a text balloon).
My question is: is there a way to make the TextField object invisible yet still interactable?What I want to do is: make the TextField object have focus without the user having to click on it (and it cannot appear on the screen, nor its text, but it must capture the typed text). Is it do-able through sheer code? Thanks in advance.
You can do this via stage.focus = textFieldInstance; (adobe reference). As for making it invisible...
All sorts of tricks are available for this
moving the textfield off screen
hiding the textfield behind something else
textfield.width = 0
setTextFormat with a font that has a size of 0...
There is, of course, also textField.visible = false, but there's a lot of things associated with that that will break what we're trying to achieve.
Whilst googling I found some cases of people having trouble with just using stage.focus however, so if that doesn't work, try this (original source):
myTF.type="input";
myTF.text=" "; //a SPACE or temp "foo" text, but NOT empty !
myTF.stage.focus = myTF;
myTF.setSelection(myTF.length,myTF.length);
myTF.text = "";
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I want to make it hard for the viewers to copy the text; On a website, they put every word in a span tag so it would be harder to copy it from the page source and I wanted to know how to do that easily.
Is there any other similar methods?
You can't really make text not copyable if you show it. You can make it a little hard tho.
document.addEventListener('contextmenu', event => event.preventDefault());
.donottouch {
user-select: none;
}
<div class="donottouch">
text
</div>
<img src="http://www.placekitten.com/200/300" width="200px" height="300px"/>
If you really want to make it hard save the text as a picture and add that to the page instead. Then you can't copy the content by inspecting the html. To make it a little harder you can disable rightclicks on a page with document.addEventListener('contextmenu', event => event.preventDefault()); making it harder to rightclick the image and save as. You can still grab the image from the html source, and open it in a new window.
So to sum up there is no way to make content on your site 100% noncopyable, you can always grab content from a public site.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
i'm making a den designing game of sorts
but i can't find anything that would help me create a ui that can allow the player to move the desired png/pngs up and down a layer. So say the player has a "flower pot" and they want to move the png of the flower pot behind the png of the "bed". How can i create this function?
http://www.agame.com/game/My-New-Room
like in this game at the bottom
they have arrows that move the png up and down,
thank you for your help in advance!
https:// jsfiddle.net/okcjt5vf/294/ this is all my code so far.
Just a high level example:
This would, on click of an element with class .adjustableElement, cause the z-index to increase by one on the element.
$(".adjustableElement").click(function() {
let newIndex = parseInt(this.css('z-index')) + 1;
this.css('z-index', newIndex);
});
In your case, you will need to define a variable selectedElement to the png/image in question (However you decide this, by clicking on it etc.). Then, you will have two functions, one to raise one to lower depending on the arrow they action.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In my little watch app (targeting watchOS3+) I need to show an image which will be fetched from a server (it is not big, let's say 600x600).
The image will be displayed alone in a modal page (only the Close button is on the top left corner)
Similar with the Photos app, I would like to be able to offer the user the possibility to pan and zoom the image.
Zooming will be done by using the Digital Crown (the events are wired up already).
Any idea how to deal with panning and zooming? Did anyone implement something like this already?
Thank you in advance!
I have solved the problem by implementing a small trick (see attached image).
Basically the zooming (Digital Crown) happens "in background" on a cached UIImage and a viewport (sized exactly as the display size) crops an area from the UIImage and shows it via the WKInterfaceImage.
Panning is done by simply moving the viewport around, following the TapGestureRecognizer data.
I think I will encapsulate this in a custom control and put it on GitHub.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Say a webpage renders a realistic world map, so the countries have jagged borders. To my knowledge, it would be next to impossible to draw divs that exactly match the country shapes using common CSS.
Is it possible to make the individual countries clickable, exactly following the borders?
For this you would use the HTML <map> element. This essentially requires that you have a static image, because you have to specify each point in an area.
http://www.w3schools.com/tags/tag_map.asp
A map element has the map name and is comprised of area child elements.
http://www.w3schools.com/tags/tag_area.asp
For arbitrarily shaped area, you would use shape="poly" and put in the x- and y- coordinates for each point.
http://www.w3schools.com/tags/att_area_coords.asp
It is also possible to use what's known as a server-side image map, though these have fallen out of fashion. These are more complicated, require a scripting language on the backend, and are considered less accessible than client-side maps. They were popular in the early days of the web.
you can use this but once you doit you cant resize the image or the map wont fit properly.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
so I'm trying to make 2.5D game and I want to make that players could hide behind objects (like walls, fountains, other players which are closer to camera).
Preview of what i'm tying to say:
So I want to ask some suggestions/help how could I do it ?
This seems like a very vague question but a basic idea will be manipulation of the background and foreground. You will need to be able to change where your character falls and whether or not the an object can be both foreground or background. If they can be both then you could declare that as a object that could be hidden behind.
I propose some solution that you could try :
with libgdx to draw an Object1 before an other Object2 you just render the object1 and then render the Object2 but to manipulate distance like you want to do, you should try to use Masking with Depth buffer
see an example in the officiel docs
https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Masking
also not very efficient but you could try :
I once try to make some object look in the background comparing to each other, so i played with their opacity color, it worked fine for what I needed
hope that was helpful good luck