[Request] use underscore instead of dash in image name

  • Hello.

    When I export a project, C2 generate images with a name like myimage-sheet0.png. For various reasons, I'm using this name in my javascript like a var name. But the dash ( - ) in the name is not useable for a var name in javascript, so I must replace all dashes with underscores ( _ ), and, when my projects count 100+ images, it's veryyyy long.

    So, is it possible to generate image with underscore instead of dash in the name ? ( = myimage_sheet0.png)

    Or is it possible to have an option in a menu and let the choice to the user ?

    Or can I modify it in a C2 property file ?

    Thanks,

    C2 is awesome!

  • One month later, UP !

  • http://searchengineland.com/9-seo-quirk ... -of-146465

    a "-"dash/hyphen is more compatible with the web than an "_" underscore.

    just wanted to add, that because construct 2 deals with html5 and the web, this is important. it can potentially help people get to your games. Also works much better with google.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • obj = {'with-a-dash':1}

    { 'with-a-dash': 1 }

    obj['with-a-dash']

    1

  • Tylermon > I don't care about SEO, my games are wrapped in Webview for Android and iOS. But thanks.

    Noncentz705 > ???

  • window['something-dash'] = "something"

    "something"

    console.log(window['something-dash'])

    "something"

  • Noncentz705 > Could you use words in your sentences ?

    A simple

    var myvar-toto = "dada";[/code:1vdnw7di] throw an error [code:1vdnw7di]Uncaught SyntaxError: Unexpected token -[/code:1vdnw7di]
  • What I posted is =what the repl returns if you were to type it into your browser console ...

    Use bracket notation to define/access the key name 'myvar-toto'

    window['myvar-toto'] = 'something';

    If the variable isn't meant to be global then you wouldn't attach it to the window object and may choose another

    var o = {};

    o['myvar-toto'] = 'something';

    This should be common knowledge if your planning a project with JS.

  • Tylermon > I don't care about SEO, my games are wrapped in Webview for Android and iOS. But thanks.

    Noncentz705 > ???

    Hyphens are the standard for naming files on the web. You can access javascript items using array syntax myobject['my-field']

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)