How do I Share an Image in Multiplayer Chat Room ?

Get help using Construct 2

Post » Mon Jul 10, 2017 1:44 pm

I want my players to be able to share images in chat room, but i cannot find a way in the forums!
How can i do this? or Is this even possible???
Thank you
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Mon Jul 10, 2017 2:32 pm

Anyone having any idea?? please share!! we can make this work ,just have to find a way around
Thank you
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Tue Jul 11, 2017 3:38 pm

Im not to sure about this but I would love to know how to implement this aswell!

viewtopic.php?f=147&t=193824&p=1131978#p1131978
Image
B
20
S
10
G
10
Posts: 229
Reputation: 7,624

Post » Tue Jul 11, 2017 3:39 pm

I would love to know this aswell I posted something aswell so we can get an answer.
viewtopic.php?f=147&t=193824&p=1131978#p1131978
Image
B
20
S
10
G
10
Posts: 229
Reputation: 7,624

Post » Tue Jul 11, 2017 3:53 pm

Thanks @laurenceBedford
Can you please PM me ASAP when you find an answer!
Thank you
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Tue Jul 11, 2017 4:10 pm

  1. Import your image
    I assume you import the image with a file chooser object.
    If so, after importing, you will have the File URL available under the FileChooser.FileURLAt(index) expression.
    Use this in the Sprite action Load from Image URL to load the selected image to the Sprite.
  2. Share the image
    The Sprite that you loaded the image to should have the behavior SpriteExt by @rexrainbow or anything similar to access the Base64 DataURL of the image.
    With the Sprite expression Sprite.SpriteExt.imageUrl, you can now access the actual image.
    You can now send what this expression returns to your chatroom and anyone who receives it, can use the Sprite action Load from Image URL with the Base64 Data URL to load the Sprite with that image.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Tue Jul 11, 2017 5:37 pm

@randomly
Thanks for this idea!
I will try it and come back with results!
Thanks again
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Tue Jul 11, 2017 6:32 pm

@randomly
I don't think this is going to work as the receiver is not making an image out of the Sprite.SpriteExt.imageUrl
Here i made some changes in chat room example....
https://www.dropbox.com/s/ke8s4o2v19e3759/chatSpriteSendTst.capx?dl=0

My events are first two in common group,
B
15
S
5
Posts: 76
Reputation: 1,200

Post » Tue Jul 11, 2017 8:38 pm

Image

Right, so here are several reasons why this doesn't work:
  1. To use Sprite.SpriteExt.imageUrl (i.e. to make it return something), the Sprite actually has to contain something, meaning, you have to wait for On image URL loaded. After that, you can use it.
  2. You can only load data URLs (the SpriteExt expression) to load Sprites from URL, not for Textboxes
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Jul 12, 2017 6:52 am

Thanks @random
I see what you are saying there so i tried using
On Image URl loaded >> set text and
when i click send it sends a really huge message after which the host automatically lefts the chat room???
WHy is that so???
B
15
S
5
Posts: 76
Reputation: 1,200

Next

Return to How do I....?

Who is online

Users browsing this forum: wenwen11212016 and 7 guests