troublesum's Recent Forum Activity

  • Sorry to bother you Ashley but I have what I feel would be an easy request. You currently have a TextBox <input> plugin that can be added but I was wonder if it were possible to get a <div> element plugin?

    The reason I would like it is that when I send ajax request to my server and it fails I like to dump (echo) the failure data to the screen in a an <pre> string with nice color and formatting so I can see what all data was received and what it tried to send back. It makes debugging much easier when my array data the server is trying to send back is CSS formatted. Currently I have to try and decipher the html string as raw text or change my whole method of debugging and its pretty time consuming.

    Not sure how difficult it would be or if others would like this as well but I hope it something you can look into when you get a chance.

    Thank you!

  • Did you add a header to the file being served allowing ajax request from external domains? It might be being blocked by your server because the request came from a website that wasnt originally served by your server.

    PHP example

    header('Access-Control-Allow-Origin: *');

  • To my knowledge this can happen when your files are no longer in the folder they were in when they were last accessed.. This happens to me when working on file from a network location that is no longer available...

  • Your probably using it wrong then... this is exactly the functionality your looking for. It guarantees the position of the object relative to the boundary of the layout regardless of scrolling or scaling. You only need to specify what corner (top,left - bottom,right , etc) to make sticky.

    I my case I have text in the top left corner of the screen but I use inner scaling so it can crop of some of screen and potentially hide some of the text. To ensure my text is always approximately 50 pixels (give or take) or so from the top left corner of the view-able layout I set the Anchor Property "Left edge" to "window left" and the "top edge" to "window top" ensuring that the top left corner of my text is fixed in its location to the top left corner of the view-able screen.

    I would play with it a little more. Or check out the manual. I'm sure this is what your looking for.

  • Take a look at the "Anchor" Behavior. Its meant for things like buttons or text that should always be in the same place.

  • Don't use the "Spawn another Object" method. Instead use "System" - "Create Object" and enter the X ,Y coordinates you want it to show up at.

  • You can add an action to the sprite "Appearance" - Set Mirrored... but to be asking this question means you didn't do any of the tutorials Ashley provided because its was covered in the first one i think. You should give them a look... they are very useful.

  • megatronx - I had this very problem as well. I tried Rexrainbow's plugin and it works well enough for creating object dynamically it was a little short of what I needed. I found a pretty simple work around though that might help. It a bit of extra code but i keep an extra event sheet that in it I create a function for each object (Sprite, Dictionary, Text, etc) with the same name and just make the return value its As.JSON element. I can them call this function where ever based on the name of the object I want and get its JSON string and load it to a temp object as needed. I also over load the function with useful commands for instance my functions that reference dictionaries all have Get, Set depending on the number of params I pass the function. This makes working with dictionairies dynamically via ajax so much easier as I feel data management is poorly lacking (currently) in C2. This is the only way I know of for now to dynamically reference objects in C2 until they are able to put it in natively.

    Example Dictionary Function Declaration:

    If the function"PlayerSettings" is called with no Parameters then it returns the JSON string of the object

    If it has 1 param then use that param as the Key and return its value

    If it has 2 param then I set the value

    Example Usage 1

    Each Setting Dictionary gets flags added to it dynamically

    Example Usage 2

    On start of layout I call the function by its string name and set the player name

    While I use more for data manage management I feel it would work for objects as well. Hope this helps

  • Ah.. there it is.. Doesn't highlight but close enough.. Thank you!

  • Hello Construct 2 community! -

    Unless I missed something (I checked the forum as best I could) there does not seem to be a "find" option available? As my event sheets get larger It becomes increasingly difficult to locate usages of global variables, functions, objects etc. As a developer I'm used to what ever IDE I'm working with to have a find function something to the effect of right click on screen, select find, type in what I'm looking for, and it will find all occurrences whether it be a variable or object or what ever and show me what line it occurs on and the file or in this case event sheet it is on. then while on that page they are highlighted so i can scroll through the document and easily see them. Not sure if this already exists and i just can't find it (no pun intended) or if it could be added?

    Thank you

  • vtrix

    You sir are my hero... Glad to see the community offering solutions as I know Ashley must be swamped with requests.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry but no...

    You need to modify the header response server side.

    <?php

    //Allows all AJAX requests from any domain

    header('Access-Control-Allow-Origin: *');

    ?>

    CAUTION!

    If you add this it will allow all requests from any domain that this website is not hosted on. I would recommend you do more reading on this before using it. But if you don't have access to the server then its kinda moot any way.

    Curious though your sending an Ajax request to a server you don't even have access to?

troublesum's avatar

troublesum

Member since 4 Dec, 2013

Twitter
troublesum has 2 followers

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies