Jump to content

input file button


odelia
 Share

Recommended Posts

I want to do an input button in phaser. 

Now I have it in the HTML but I want it to be part of the game...

<input id="browseinput" type="file" accept="image/*" onchange="getImage(this)" class="inputfile" />
<label for="browseinput"><img id="browserBtn" src="assets/images/UI/uploadBtn.jpg"></label>

Is there any way to do this?

Link to comment
Share on other sites

Using standard input boxes is a separate issue to Phaser, if you want them to look a certain way then you'll have to style them. You can do this inline in your JS if that makes sense or you can use CSS.

If you scale your canvas instance/s (via Phaser for example) then  you'll have to also move your input, again, styling is the way to achieve this (just as the canvas element changes size/position via styling).

If you have already implemented your UI using canvas/phaser then it may make more sense for you to continue in canvas rather than extract your UI out to the HTML.

Link to comment
Share on other sites

I do style the button with inline css. I just need to figure how to get the correct data (size, location) from the phaser canvas with the scaling.. 

for example - if the phaser canvas scale in 2.5 then i would scale the button the same.. but how do I get the phaser scaling?...

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...