Message feed for Android.

Explorer ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

I looked for some tool that could help me in the development of a message feed, but I didn't find anything that could guide me. See the example image: https://prnt.sc/ydeq1k

 

Basically the message is typed in a secondary location, and replicated on the Animate stage through ActionScript 3.

Could someone please give me a light? Thanks in advance.

TOPICS
ActionScript , Ad development , Code , Timeline

Views

116

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

Hi.

 

Firebase or the LocalConnection class may be what you're looking for.

 

Firebase:

https://github.com/PhantomAppDevelopment/firebase-as3

 

LocalConnection:

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html

 

[video]

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

Hello, João, how are you? That way, would I have to look for a dedicated server, or something? Because the initial intention would be to keep these messages visible to everyone who has the APK.

I saw that the structure was made through SWF, can you help me how it would work?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

LATEST

I would go with Firebase. It's a service, so you won't need to setup any server. You'll need to only learn to access their REST API.

 

The user phantom, from the link I sent to you, has a sample of a chat functionality in this link:

https://github.com/PhantomAppDevelopment/pizza-app

 

These are two functions from the Pizza App he developed:

protected function loadMessages():void
		{
			var header:URLRequestHeader = new URLRequestHeader("Accept", "text/event-stream");
			var request:URLRequest = new URLRequest(Constants.FIREBASE_CHATROOM_BASE_URL + _data.selectedRoom.id + '.json?auth='
					+ _data.FirebaseAuthToken + '&orderBy="timestamp"&limitToLast=100'); //We are always loading the last 100 messages
			request.requestHeaders.push(header);

			messagesStream = new URLStream();
			messagesStream.addEventListener(ProgressEvent.PROGRESS, progress);
			messagesStream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
			messagesStream.load(request);
		}

 

private function sendMessage():void
		{
			if (messageInput.text != "") {
				sendButton.isEnabled = false;

				//We prepare the vars to be send to the database, including the logged-in user basic info
				var myObject:Object = new Object();
				myObject.message = messageInput.text;
				myObject.timestamp = new Date().getTime();
				myObject.senderId = Main.profile.localId;
				myObject.senderName = Main.profile.displayName;

				var request:URLRequest = new URLRequest(Constants.FIREBASE_CHATROOM_BASE_URL + _data.selectedRoom.id + ".json?auth=" + _data.FirebaseAuthToken);
				request.data = JSON.stringify(myObject);
				request.method = URLRequestMethod.POST;

				var loader:URLLoader = new URLLoader();
				loader.addEventListener(flash.events.Event.COMPLETE, messageSent);
				loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
				loader.load(request);
			}
		}

 

It uses Starling, but it should give you an idea of how to write to and read messages from Firebase.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines