Actionscript :: Make A Synchronous Xhr Call From Flash?
Feb 7, 2012Is it possible to make a synchronous xhr call from flash?How do you do this in actionscript?
View 1 RepliesIs it possible to make a synchronous xhr call from flash?How do you do this in actionscript?
View 1 RepliesI have a big loop in actionscript that sends lots of data to an url:
for(var i=0;i<1000;i++) {
var request:URLRequest = new URLRequest();
request.url = url;
request.method = URLRequestMethod.POST;
request.data = data;
var loader:URLLoader = new URLLoader();
loader.load(request);
}
The problem is because URLLoader can make only asynchronous calls, it sends all those thousands requests at once which kills webserver. Also it acts a bit strange on top of that. Lets say the loop is running for 5 minutes. For whole 5 minutes there is no requests coming to web server, then at the end they all are sent at once. I already tried everything I could possibly think of (empty loops, callbacks, delays) - nothing works. All requests are sent at once no matter what. How to make requests synchronous, so it will send one request after another?
In the code below when I call chkAuthentication function from another function the remoteObj.login (login function in my service file (.php)) is called after the remaining code in that function. i.e., the loginStatus is returned from the function before the result-handler function loginResult is called. but my loginStatus is supposed to be set in loginResult function. It seems that the asynchronous behaviour is the culprit. what should I do in order to get the loginResult function to complete first?
[Code]...
what is synchronous and asynchronous call in flex. Why Httpservice is asynchronous and how to make a call to asynchronous call.
View 3 RepliesIs it possible to make httpService Requests synchronous in Flex?
View 2 RepliesThis is a very newbie question.I want to know how to create a WEB APP to make Call ( using VOIP protocoll I think ).What program languages do I have to learn ( client and server side ) ?
View 5 RepliesI am developing an application for andriod and iphone in the Adobe Flash Builder,how can i make a button that when is pressed the phone(doesnt matter which phone) forwards the number to the phones dialer or makes it VOIP call
View 1 Repliesmake a circle object movie clip call ball and make a rectangle object movie clip call mc and paste this coding.
[Code]...
can anyone explain about the movement about D? the D is talk about the distance if i go -X,way my ball go ++ to +x?
Is there a way to make synchronous calls using RemoteObject in Flex?
Solution: Add the second call to the result handler of the first call, having a token check for multiple originating calls.
I need a Synchronous loader for my AIR application.The URLLoader class does not meet my needs because of its asynchronous nature.It continues the execution of code. I need to stop the code until the loader loads the Html text.
View 5 RepliesI have XML displaying in dynamic text boxes. Some of the text are a href links, I also want to track which links are clicked by sending a javascript call to Google Analytics. Is there a way to do it and also open the link in a new window?
View 1 RepliesI'm trying to edit some flash to make an external javascript function call, but with no success. Here's my actionscript 2.0 code:
[Code]....
I've seen lots of examples and I'm mainly confused about the use of ExternalInterface.addCallback. I don't need the javascript to return anything to flash, so is this necessary? For whatever reason, I never see the alert. Does anyone see any problems in my code? Is there some ExternalInterface library I don't have? Also, what's the BEST way to use ExternalInterface (ie; error checking, etc.)
Web service calls are asynchronous in flex, but I wanted to wrap a web service call in a class to provide synchronous encapsulation. Something like the below - the user could call getMyMethodResult and get the result returned by the web service. I expected the thread that recieved the soap response would populate the variable _result and mean that getMyMethod would, after a time, find _result is not longer null. But it doesn't! Can anyone explain why this does not work?[code]
View 1 RepliesI'm using flex4 and actionscript, and need to treat an event in a synchronous mode. Is it possible that? More exactly, i want to execute some queries in a database, and need to be synchronously.
View 1 RepliesIs there a way to have a synchronous call to a URL to retrieve the HTML code? If not, is it possible to turn an asynchronous call into a synchronous one using some trick? I can't believe Adobe wouldn't implement this option. I tried looping until the result is back but then the status function never fires making my loop infinite.
ranting.turn("ON");
I'm a ColdFusion developer and recently started working on a project in Flex. I am getting more and more frustrated with AS and Flex lately. It seems that whatever I'm trying to do is either really hard or impossible while it usually can be done with one line of code in ColdFusion. I'm still learning these languages and I'm sure my lack of knowledge is the reason but for some reason I can't get ahead with my project. It looks like the learning curve is much steeper than it should be.
ranting.turn("OFF");
Anyways, here's my code for testing this functionality. The main application file looks like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
<mx:Script>
[code]....
This works OK except the function returns false before the HTTP call returns its result. If I un-comment the while loop the onStatus function will never be called and therefore end up with an infinite loop. Not sure why this happens.
i am not an action script developer nor flash designer, i just want to have a small action script sample that i will edit a little to make it interact with my javascript code. By the way, i want to have a button and a label on a flash form, when the user clicks on this button the onclick event will call another function 'setText for example' this setText() function will change the label text. So i think the code will be something like this:
[Code]....
I managed to put the button and the label i want just the code i will write to make this work.
I have small Flex web based util with single button. On this button click a request is sent to server and the response must be read in the same call.This is important not to wait for response with event handler (which is trivial).Basically this is synchronous call.I am ok with blocking ui and so on.
View 1 RepliesA simple piece of code that should trace [code] and I get something completely far away from that,[code]Is the trace function that bad? that slow? is it the fact that passing an argument to the function take so much time compare to the other one?is there something I can do to avoid this type of weirdness ?(For the record, my project is not to trace {rien, done and test}... I have 15k lines of codes that react completely differently if I compile them with "Omit trace statements" or not.
View 2 Repliesi am using soundmanager to order sounds. my site preview, in home page, square shapes comes into stage and you can drag drop them, all shapes binded its own sound. if they are colliding binded song will play.
the problem is i have 3 second timer to control sounds. every timeout i have to stop sound and play again for synchronous issue, that is my solution for that part. but sometimes before loop, there is an annoying little silence.
I'm tryng to make a public static method call another method, but Flash throws error 1180, sayng that the method called by the static method is undefined.
Code: Select allpackage
{
import flash.display.MovieClip;[code]....
I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.
Can this be done? I am trying to use the ExternalInterface.call()
AS:
ExternalInterface.call("function(){return window.someVar}", null);
JS:
var someVar = "Test";
This does not work and I suspect it is because the ExternalInterface.call() does not like the anonymous function.
I have a function defined in JavaScript like so:
function fadeBack() {
alert("fadeBack called");
};
I call that function from my Flash file like so:
import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");
This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?
i have some actionscript that makes a
ExternalInterface.call('someFunction');
call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?
Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.
Currently:
Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);
[code]....
We have been given some code that does a URLRequest call which is really slow to respond, so I was looking to make it pull the data from the page, as it is already on the page.[code]I have tried to replace it with this (actionscript is definitely not my forte):[code]I am using addCallBack as that is what the editor suggested via autocomplete, unfortunately it doesn't seem to work. Unfortunately I cannot go back to the developer at this time.The error message is:Call to a possibly undefined method addCallback through a reference with static type flash.external:ExternalInterface
View 3 RepliesHow to make getServerStats() API call?
View 7 RepliesI am trying to give a TextField a property such as:
Code:
field.debug = function(){ trace this.text; }
But it says: "cannot create property debug on flash.text.TextField"
What I want is to be able to make the 'this' keyword refer to the TextField. Is there another way of doing this?
I'm trying to make a timer..
When I press a button a movieclip does this: gotoAndStop(2);
I want it to go back to Keyframe 1 after 10 seconds.
How can I get this to work?
I'm trying to make a loaded SWF call a function that is in the parent SWF, but it is not working.In AS 2.0 I could just put something like _root.myFunction(); and it worked.But in AS 3.0 it does not work anymore.
View 3 RepliesI want to make an https call using HttpService. My code is working perfect when the url is http, but when i can the url to https is gives me the following error [code]...
How should I make a Https call?
I found a lot of tutorials that show how to use getDefinitionByName() to create an instance of a class. Something like the following:
Code:
var classRef:Class = getDefinitionByName("menus.buttons.Icons") as Class;
var iconClassInstance:Icons = new classRef() as Icons;
[code]....