How do I create an image when app is running using filedrop

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • The idea is drag an image on your pc folders and drop into the app window and show as an sprite.

    At the moment i get how to create a sprite when an image is dropped in the windows and set their binary data inside the Base64 variable of the sprite.

    Here is the capx.

    https://dl.dropboxusercontent.com/u/659 ... drop1.capx

    So, or i find someway to convert that binary data into Base64 or directly set the sprite an image using the binary data.

    In case the convert to Base64 is correct the events are done so the image will appears.

    Also you will need this behaviour to open the .capx. Is a behaviour to extract the Base64 from an image:

    viewtopic.php?f=153&t=68494&p=873882&hilit=pode+base64+extract

    But can convert the binary data to Base64 seems <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad"> .

    Any idea?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The idea is drag an image on your pc folders and drop into the app window and show as an sprite.

    NWjs On file dropped--------------Sprite load image from NWjs.DroppedFile

    why you need Base64?

  • Ah! i don't know the sprite load image also get that. (I knew URL and URI(base64 but not also binary data)

    I'm using Base64 for store the image data in a variable. So after i save all values in an array and export the array.asJSON,etc...

    So in a new running of the app if you load that .json all the composition and images are loaded.

    Then, seems i can store the binary data in a variable instead the Base64 to after apply using Load image URL? I'm going to try it!

  • korbaach I'm looking the variable to store the image data and the NWjs.DroppedFile saves the folder direction of the image in the PC not the data. So if i export the sprite data .jSON if somebody in other PC loads its if not have the image in the same folder none image will be loaded. For that i used Base64 because i not found another way to save data in .JSON.

    Is there anyway to manipulate binarydata in the sameway as Base64?

    Also when a file is dropped all the sprites changes their image to the last image dropped, because they share the same image texture.

    How i can tell that every time a file is dropped creates a new sprite and load an image without share it with an other instance of the sprite? Or not is possible? And in case of not, how solve it to drop various image files and show all the diferent images??

  • I'm really not an expert..but for multiple images you need multiple frames..

    then pick instance with id 1..set frame to 1 ..load image from dropped file ..on image loaded extract to base 64(with Pode behavior)..

    or you can try with some SpriteHelper..load image,then extract to base64..push to Array..then load Sprite image fom array...

  • Yep, i design the same solution XD. Create a .gif with 1000 frames of 1x1 pixels and load it on the sprite, in animation called "Imported image".

    So if the sprite Base64 variable is different of "" then set animation to "Imported image", set frame to Zorder variable of the sprite and load image using the Base64 variable data.

    ---

    Will be great if there is some way to "object-clone" action so will have an sprite object with the same properties but without share the image texture. Or an option in the Sprite properties of an object on you can say "Share image texture with other instances: Yes/No" and problem resolved. What you think Ashley , this can be a new feature or there is another way to fix the problem we're missing?

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