Prototyping In Flash - Using JSON For Web Services?
Mar 19, 2011
I know most people hate 100% flash-based websites, but I was recently forced to use flash for a college assignment. After creating a fully-featured ria in less than 2 weeks with every feature I could imagine, i've regrettably fallen in love with this beast (which I previously refused to touch with a stick) due to the power of AS3 and the ability to sprinkle it everywhere :-
I now want to port a commercial desktop application of mine (which has been largely unsuccesful) to the web and feel flash/flex is an excellent candidate. While creating a html/css/js version would be ideal (working browser shortcuts, for a start), i'm certain it'll take a year to create in cross-browser html/css/js what would take just ~3 months in flash. Obviously as the (paid) desktop product was unsuccessful, i'd want to minimize the risk/investment in the (free) web application.
I plan on using JSON for web services, so it shouldn't be a huge pita to port in the future.Is this a good strategy for launching a web app you're not yet 100% committed to? Or will the fact i'm using flash doom me from the start? Has anybody else done this? If so, how did your userbase respond to the 100% usage of flash, and did you get around to porting it to standard web technologies?
Although iPhone support JSON natively, AMF is a binary protocol and it supposes to use much less bandwidth. Do you think using AMF is a good idea?Just found this AMF library in cocoa (Objective-C):Here's the famous benchmark that shows AMF is smaller and faster than JSON + gzip in Flex:
I'm working on a Flash AS2 application that needs to post JSON data to a web service.In previous projects, I've used LoadVars.send() or LoadVars.sendAndLoad() successfully to manage this:
var send_lv:LoadVars = new LoadVars(); send_lv.data = JSON.stringify({some json object}); var response_lv:LoadVars = new LoadVars(); response_lv.onData = function(rawdata) {
[code]....
In somepage.php, I can grab that JSON data using $_POST['data'].However, on this project, the developer of the web service requires the JSON content to be the BODY of the request (i.e., not a name/value pair). Is this possible with LoadVars?
I was wondering if someone could explain or point me in the direction of how to implement an API that uses JSON in ActionScript 3.0. What I specifically want to know is how would I grab specific information. The following is how I do it in XML but I don't know how I would do something similar in JSON as in getting the equivalent of an XML tag. For example with the twitter API I'd like to grab the text [URL]
Created an editable flex grid which exposes a method called getGridData() to javascript. I am using the JSON.encode() method of the [url]....library to convert the grid object's dataProvider into JSON before returning it.
ExternalInterface.addCallback("getGridData", getGridData); public function getGridData():String {[code].....
However, when I sort a column in the user interface, the encode method is failing throwing the following error
Property usingCustomCompareFunction not found on mx.collections.SortField and there is no default value.
I have a pure ActionScript 3 problem, but the simplified test case I've prepared is in Flex 4 for better visibility (the source code is below): Since Flash Player 11 / AIR 3 support JSON natively, I've decided to move a multiplayer game, which used XML for communicating with server, to JSON. But I have a frustrating problem, that given two Objects like
i've been using a MovieClip prototype to create and set a color object, like this:
MovieClip.prototype.setRGB=function(hex){ (new Color(this)).setRGB(hex); //creates color object + sets color }
which makes it easy to change a MC's color like this:
MC.setRGB(0x00ff00);
now i'm working in AS 2.0, which seems to discourage using prototyping and extending the MC class methods--so my question is, what is the best approach for doing this in AS 2? i've created a new class to handle it, but it seems clunky to have to call an instance rather than having a MC call an internal method...the bottom line, is: is it ok to extend the MovieClip class in AS2, and if not, what's the cleanest approach?
I have to work with webservices in Actionscript. I found the following code that allows me to use JSON URLs that implement only the GET method. However, it doesn't work for POST methods (doesn't even enter the "onComplete" method). How can i "POST" JSON data using Actionscript 3.0?
Ive been having a problem with a MovieClip prototype. The code i used is below - the problem being that the onLoad event never happens.If i change the onLoad event to apply to the MovieClip class and not the PlaylistItem class then the event fires fine.[code]
Ive been having a problem with a MovieClip prototype. The code i used is below - the problem being that the onLoad event never happens.If i change the onLoad event to apply to the MovieClip class and not the PlaylistItem class then the event fires fine.
//constructor PlaylistItem = function(){} //inherit from MovieClip PlaylistItem.prototype = new MovieClip();
I've recently started using FDT, for a while I was using FlashDevelop, it had a really handy feature in Compiler options where you can set UseNetworkServices to false which would stop the compiled swf from connecting to the internet and became very useful for running standalone flash apps without security warnings when loading in an external xml file etc.
I'm a beginner in WCF, which I have chosen instead of Web Services because all articles and blogs I've read seem to point out that ASMX is old news.I have read a bit about the differences between old Web Services and WCF, and I got the general idea. I also took the MSDN WCF tutorial which seemed simple enough.My problem is that I want to create WCF services that can be consumed by Flash. I've read that it's doable everywhere, but with no obvious A-Z tutorial on how to proceed with the server-side and client-side...
my team is building a game in flash to be embeded in a asp.net application.When the game is over the player have the chance to type his name to save his score.This is done using web services called from flash. The webservice receives the name and score.Since the webservice is publicly available how can I make it only callable from my flash given the following conditions:The .swf is hosted by the same asp.net application There are two domains that can access the same application (I have run previously into cross domain issues).Using SSL is not an option. The webservice has to be consumed by the .swf file.
What would be the best way to secure .net web services used by a flex application (both desktop and browser) that requires login? I thought about requesting the user and password in every method of the web service, and having them stored as variables in the flex app, but I don't feel like this is the most elegant way.
I am using Flex/Flash to build a UI which front-ends my Rails server application. I am using WebORB as the communication mechanism. My question should apply beyond just WebORB, however. (I think).
Specifically, it has to do with the services-config.xml file. I have a local (laptop) dev environment, a remote dev and a remote production environment. I am sick of editing the URL in the services-config.xml file, rebuilding and deploying every time I want to test in a different environment.
[Code]...
By setting the URI="/weborb" and giving it a relative path, I figured it would work. locally--but it doesn't when I deploy it to my remote dev and prod environments (Heroku). Weird.
I am using the web services connector but it only works if I set the publish settings to compile for Flash Player 7 or above and I need my movie to run on version 6. The web services connector should work from version 6 and I have used it before and published for v6 but for some reason the movie will publish without an error but the web service won't trigger. If I change the settings to publish for version 7 or 8 then it works fine. Here's my code if it's any help:
ActionScript Code: import mx.data.components.WebServiceConnector; var webServiceURL:String = "http://myurl.com"; var wSCheckConnection:Object = new Object();
I've been trying to set up an instance of Flash Media Interactive Server on Amazon Web Services for an AVChat (avchat.net). I signed up for the service here:[URL] I have some simple questions on getting it started --- namely: do I create the FMIS instance myself now that I've signed up, or do I need to go ahead and create it? I see under the EC2 tab I can create an instance under 'Community AMIs' for adobe-flashmediaserver-useast/fms-4.0.1.8011-centos-5.5-ami-1.manifes t.xml Is this what I want? I realize this is a bit of a noob question.
once installed what I'm trying to do is to add a folder for AVChat into /opt/macromedia/fms/applications/ ([URL]). I am assuming that once I do have this instance running, I can move/modify files on the server instance.
I have just started using Adobe Flash Media Server on Amazon Web Services. Does anyone know how can I monitor server statistics such as the number of active connections? I have connected using SSH to the server but I cannot know what to do from this point on?
Context : I'm working on a Flash application developed with FDT and compiled with Flash CS4 (I need a huge library). It should connect to various Weborb services.Weborb is properly configured. My services are properly executed, and values returned, via the management console. Weborb examples as well as various tests compiled with Flex are fully functionnal.
Problem : when I try to adapt the code to compile with Flash, and setup the remote object like this :
var remoteObject = new RemoteObject(); remoteObject.destination = "GenericDestination"; remoteObject.source = "MyServices.MyService";[code]....
Question: how to properly setup a RemoteObject to connect to a Weborb remoting service from a Flash application compiled with Flash ?
I've (actually my classmate) got a problem with loading local ZEND_AMF services on Windows 7 (XAMPP). I can't find any answer on Google or on Stackoverflow. I found one similar topic without any answers: ActionScript 3 AMF Zend fails silentlyLet me describe the problem: I've developed the UI and dataloading for a Memory(matching) Game in FLASH CS5. The games uses data from an ZEND Framework website (you can add levels/cards/images there).[code]Everything works fine on my Macbook Pro (Using MAMP as local server), but a classmate (who's helping with it) of me that is using a Windows 7 laptop with XAMPP doesn't see anything. We're both using Flash CS5.5.For some reason his Flash isn't able to load local services. When he uses the same URL path like me Flash doesn't do anything in the responder. No Error function call and No Complete function call. We've been searching for the cause and tried several things.In a ZEND_AMF tutorial on the Internet we've found an online AMF Service and put that in the code. Of course we're using a nonexisting service function so the responser will call the Error function. And yes, this works. He runs the function returnError(). The cause of this problem is obvious: Flash on my classmates PC (using XAMPP) won't load local services. Allowing swf to correspond with non-local URLs (is an option where you have to add your swf to the Flash settings) => Has happened
I'm trying to send array of data from Flash to PHP to sending e-mail. I'd like to do that because I must change the php page everytime my form site changes because of client's choice.[cod]e...
I'm trying to pull data into flash using JSON but i keep getting this error
JSONParseError: Unexpected < encountered at com.adobe.serialization.json::JSONTokenizer/parseError() at com.adobe.serialization.json::JSONTokenizer/getNextToken()
When using SOAP web services in Flash Builder, I am able to use the web services tool and test making service calls without any issue.I can pass strings that contain spaces, double and single quotes with great success. when I write code to send a string containing spaces or quotes, the web service doesn't return a success response.If I remove the quotes and/or spaces, success.I've tried wrapping the string in tags, but I don't know what else to do.