How do I retrieve an Input element's ID in an expression

0 favourites
  • 2 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I have a FileChooser input element on the canvas that I currently use the ID property to select it with a custom plugin. At the moment I'm using a string to manually select that ID and I would like to use an expression within Construct to load the ID of the specific instance I select within the events; however, there is no obvious expressions under the object to do so that I can find.

    Other than manually setting an instance variable to the same name as the ID for each instance manually created is there another way to get that ID or even generate the ID upon the creation of an instance of the FileChooser?

    It's not a big deal since I can manually hard program the fields on each instance if needed or a different work around, but it would be useful if I could set and select them via the event system.


    If the above is not possible would it be possible to pass the instance's input element to the function itself if I have it targeted in my events? I am currently using $("#ID") to select it but if I could just bypass it all around and retrieve the file's blob(not blobURL) and pass that through then that would elminate the need to even put in IDs for each input as I could just use the event system's instance selection.

    I current use a manual ID string and then have the plugin detect the file using this line

    var file_ = $("#" + fileInputID_);[/code:3vkggff3]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So as a temporary solution I've made another custom plugin that literally does this:

    	Acts.prototype.changeID = function (oldID_, newID_)
    		var file_ = $("#" + oldID_);
    		file_.attr('id', newID_);
    In events:
    I made it a plugin because I didn't want to use BrowserExecJS due to potential issues, but I might end up just reverting to it if the custom plugin is just annoying to deal with.
    An inelegant work around for now, but I'd be surprised if there was really no way to pass the info I need through normal Construct functions.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)