I'm trying to open a connection to a URL that will periodically send over a JSON object. I know that I need to use URLStream and some event callbacks, but I'm in the dark when it comes to knowing how streams of data "work," or the general flow of operations. Assume I know how to open the connection and send the correct request headers. First, some relevant code:
I'm attempting to connect to an existing Comet-style long-poll service using an AIR app. The service expects a client to make a GET request with a Connection: Keep-Alive header. This request will remain open for long periods of time so that the server can push data through. In my app, the connection is terminated with an IOError after 30 seconds.
Is this an undocumented limitation of URLStream? A restriction on adl (I've only been running my app through adl)?
The server does not send any "keep-alive" messages to the client but, unfortunately this is not something i have control over.
Update
To test this, I've set up a stripped-down version using a little php script (linked by leggetter below) and am hitting it from a simple AIR app. I'm finding that my connections are closed after 30 seconds whether I use URLStream or URLLoader. the PHP:
<?php set_time_limit(0); sleep(40);
[Code]....
If i adjust the initial sleep time in the php script to anything over 30 seconds, the IOError event is triggered. If I lower the sleep time, but the request continues adding data past 30 seconds, the onComplete event is called, but _urlLoader.data is empty.
The only way this process completely successfully is if the entire thing is over before 30 seconds elapses.
Apart from using BlazeDS, are there any pre-existing libraries that implement long polling (or server push) in Flex?I've read I like to implement Flex to Server comet / long polling for games, but he's only asking if it's possible to implement... Not if implementations exist.
Is anyone else aware of the fact that Internet Explorer (at least version 8) keeps downloading a file even if the close() method is called on an URLStream instance? Heck, it even keeps downloading if you close the tab displaying the site which called the load()/close() methods on an URLStream instance. Does anyone know of a solution to overcome this problem? More details: My preloader is loading a dozen of files and immediately closing the download streams with the purpose of checking each resource's file size. In Mozilla Firefox all goes well, exactly as expected, but Internet Explorer keeps downloading the resource even if the stream has been interrupted by the action script close() method.
I'am making a advanced mp3 player arund this tutorial: [URL] and i want the users of the player to see how long they have listen or how long time back of the song. i have the AS i what to use but i cant connect them. becuase the tutorial i used does not make a sound objekt (MUSIC)
I'm trying to play a 10 minute long video (h264/mp4) which is 39MB in size, after I call stream.play(fileURL) it doesn't start playback until its loaded around 12-16MB of the file (many many seconds later), I finally get onMetaData at this point too. Why doesn't it begin playback right away, or at least w/in a couple seconds? What can cause this bloated lead in time?
This is one of those rich media interactive ads, that have the ability to launch another SWF using _root.myPR.openPanel(1); The user has 3 choices identified as option1, option2, option3. I would like to not just openPanel on pr_submitBtn.onRelease, but to have the panel open & advance to a particular frame depending on which option the user chooses in the poll. I have the following launching the panel but not going to different frame labels in the panel launched. All 3 options simply stop on frame "one".
Code: if (option1 = true) {_root.myPR.openPanel(1, "one"); } if (option2 = true) {_root.myPR.openPanel(1, "two");
So I have streaming video coming in, and I want to know when it is buffering. This is fundamentally not that hard, just adding an EventListener for some type of buffering event, but I was wondering if this is necessarily the "best" way to do it.
My other thought was setting up a timer that polls the video feed every X milliseconds asking it if the video isBuffering(), or somesuch. While I could, in the worst case, wait the full X milliseconds before querying the video stream, I've decided that this doesn't actually matter to me; I can work around it, and indeed do so quite naturally already.
So I'm asking: is there substantial overhead involved in having an EventListener (assuming I already have quite a few), or is the advantage of catching the buffering event right away sufficiently appealing?
I'm building a remote presentation tool in AS3. In a nutshell, one user (the presenter) has access to a "table of contents" HTML page with links for each slide in the presentation, and an arbitrary number of viewers can watch the presentation on another page, which in turn is in the form of a SWF that polls the server every second to ensure that it's on the right slide. Whenever the admin clicks a slide link in the TOC, the database gets updated, and on its next request the presentation swf compares the label of the slide it's currently displaying to the response it got from the server. If the response differs from the current label, the swf scrubs through the timeline until it finds the right frame label; otherwise, it does nothing and waits for the next poll result (a second later).
Each slide consists of a movieclip with its own nested timeline that loops as long as the slide is displayed. There's no actionscript controlling any of the nested movieclips, nor is there any actionscript on the main timeline except the stop();s on each keyframe (each of which is a slide in the presentation).
Everything is built and working perfectly. The only thing that's troubling is that if the presentation swf is open for long enough (say, 20 minutes), the polling starts to have a noticeable effect on the framerate of the movieclips animating on any given slide. That is, every second, there's a noticeable drop in the framerate of the animations that lasts about three-tenths of a second, which is quite noticeable (and hence is a deal-breaker for the whole presentation suite!).
I know that AS3 has issues with memory management, and I've tried to be diligent in my re-use of objects and event listeners. The code itself is dead simple; there's a Timer instance that fires every second, which triggers a new URLRequest to be loaded by a URLLoader. The URLLoader is reused from call to call, while the URLRequest is not (it needs to be initialized with a new cache-killing value each time, retrieved from a call to new Date().time). The only objects instantiated in the entire class are the Timer, the URLLoader, the various URLRequests (which should be garbage-collected), and the only event listeners are on the Timer (added once), the URLLoader (added once), and on the routines that scrub backwards and forwards in the timeline to find the right slide (and they're removed once the correct slide is found).
I've been using mr doob's stats package to monitor memory usage, which definitely grows over time, so there's gotta be a leak somewhere (it grows from ~30 MB initially to > 200 MB after some scrubbing and about 25 minutes of uptime).
I have a flex app that polls a php script every 1-2 seconds and returns new data. The polling is done with a URLLoader.load call;the requests are HTTP GETs. The app listens for Event.COMPLETE, handles the incoming data, waits for 1 second, then makes another URLLoader.load call.
This process works perfectly for any duration from 4 to 20 minutes. Eventually, a URLLoader.load call fails to return Event.COMPLETE. Instead it hangs for 60 to 180 seconds (depending on which local network I'm using for internet access) and finally returns an ioErrorEvent.IO_ERROR with the message "Error #2032: Stream Error. URL: <mysite.com/foo.php". The app tries to make another URLLoader.load call, but from this point onward, none of the loads return Event.COMPLETE. Also, none of these post-error HTTP GETs appear in the access.log file of my apache (2.0.55) webserver. The app will not work again until I close and reopen the browser.
I've spent several days trying to figure this out! The time until the app crashes appears to be completely random. The problem occurs in both Firefox (2.0.0.15) and IE (7.0.5730.11). I've read that sometimes 2032 errors can be related to caching, but there's no directives (in .htaccess file or httpd.conf file) that sets the Pragma or Cache-Control response header to "no-cache".
I can't tell if the problem is on client or server end. Based on the adobe language references and the forum posts I've read, this seems to be an appropriate use of URLLoader. (In case you're wondering I want the app to respond to events in near real-time. I originally used xmlsocket to push data to app from server. However, this communication is blocked by corporate firewalls, so I need an alternative method)
I'm using URLStream to download 30-80mb files over HTTP. It downloads fine on Windows XP, but is extremely laggy in OSX. Anyone had similar issues? Here's some snippets of the code.
I am trying to upload and download a file from the server. After uploading if I Try to download the file it is not downloading. URLStream.bytes Available returns incorrect value. If I close the AIR application and try it ,it will work perfectly.. Why URLStream.bytesAvailable returns incorrect value just after uploading..
I successfully built a XML gallery; everything seems to work fine. But everytime I click on a thumbnail, I will get the following error:Error: Error #2029: This URLStream object does not have a stream opened.I researched on this error, and it seems this error involves sounds. Something about trying to load something that's already fully loaded. Therefore, I'm confused since I don't have any sound in my gallery. On top of that, the gallery works just fine but this error keeps popping up in Flash.[code]
In my AIR app,I am trying to implement a file downloader using URLStream.
public class FileDownloader { // Class to download files from the internet Function called every time data arrives[code].....
I simply create an object of the above class and passing the url and the file and call the load function. For some files I get the following error.
remotePath: http:[url].....error while writing bytes from...Error:Error #2029: This URLStream object does not have a stream opened.Which means the error is from the file stream(fileAccess) that I am using. I am unable to figure out why this could be happening. If I try to open the url http:[url]... in the browser, it opens properly. This happens randomly for some files.
In my case I need to be able to cancel loading as the user could possibly be scrolling through alot of images and the if not canceled it can take a few minutes to catch up to the scroll position.So after research the URLStream class seems to cure this problem and I found a good streaming class hereThis class works very nice except when there is heavy load on the server causing lag.When this lag happens the class will dispatch the complete event yet the image will not show.Watching the download with HTTPFox shows the image in fact does get loaded.
I assume there is some kind of delayed issue with the URLStream class and the author of this class tried to correct it using the setTimeout method. I also tried delaying the dispatching of the complete event using a timer and not dispatching until if( this.width != 0 ) was detected and this seemed to work much better.But it is still haunting me just not as often.
I have to be able to cancel and kill a Loader process properly and many times. If I dont do this, it seems that the flash player (at least on mac) eventually crashes as some loader processes are flying about , strangling the CPU.
There doesnt seem to be a straightforward way to know this and just calling a Loader.close causes an error, if the stream is not open.
I successfully built a XML gallery; everything seems to work fine. But everytime I click on a thumbnail, I will get the following error:
Error: Error #2029: This URLStream object does not have a stream opened.
I researched on this error, and it seems this error involves sounds. Something about trying to load something that's already fully loaded. Therefore, I'm confused since I don't have any sound in my gallery. On top of that, the gallery works just fine but this error keeps popping up in Flash. Does anyone have information about this error and how to resolve this?
I'm writing a Comet-like app using Flex on the client and my own hand-written server.
I need to be able to send short bursts of data from the client at quite a high frequency (e.g. of the order of 10ms between sends).
I also need the server to push short bursts of data at a similarly high frequency.
I'm using NetConnection.call() to send the data to the server, and URLStream (with chunked encoding) to push the data from the server to the client.
What I've found is that the data isn't being sent/received as soon as it's available. For example, in IE, it seems the data is sent every 200ms rather than as soon as NetConnection.call() is called. Similarly, URLStream isn't making the data available as soon as the server is sending it.
Judging by the difference in behaviour between the browsers, it seems as though the Flash Player (version 10) is relying on the host browser to do all the comms. Can anyone confirm this? Update: This is very likely as only the host browser would know about the proxy settings that might be set.
I've tried using the Socket class and there's no problem with speed there: it works perfectly. However, I'd like to be able to use HTTP-based (port 80) connections so that my app can run in heavily fire-walled environments (I tried using a Socket over port 80, but that has its problems).
Incidentally, all development/testing has been done on an internal LAN, so bandwidth/latency is not an issue.
Update: The data being sent/received is in small packets and doesn't need to be in any particular format. For example, I might need to send a short array of Numbers, and this could either be encoded in AMF (e.g. via NetConnection.call()) or could be put into GET parameters (e.g. using sendToURL()). The main point of my question is really to see whether anyone else has experienced the same problem in calling NetConnection/URLStream frequently, and whether there is a workaround (it's also possible that the fault lies with my server code of course, rather than Flash).
This is absolutely driving me crazy. While I'm a fan of the availability of asynchronous calls in AIR, I'm finding that being forced to use them for something that should be SUPER simple is a severe limitation. So severe that I may end up abandoning AIR and writing native Android and iOS apps instead of using the shared AIR platform.
OK, now that I have that off my chest, here's what I'm trying to accomplish. I have an app that, when deployed, is relatively small. But once deployed to a user's device that user will log in using a login name/password. Once they log in, content specific to that user needs to be downloaded and saved to the local device. Since the content varies by user I can't include it in the package for deployment.
But I cannot figure out how to accomplish this: say I want to download 10 files and each file is 2-3mb and I want to show a "Downloading, please wait..." view during the download. The application cannot proceed until all 10 files are downloaded. But since from what I've seen URLStream and URLLoader are both async I cannot figure out how to block the app from opening the "View available content" and say on the "Downloading, please wait..." view.
I Have Flash CS4 and a pretty decent system with Vista and 3 GB of RAM. However, whenever I click on anything in Flash, it takes about 3 or 4 seconds for it to become active. If I click a keyframe, the stage won't come up for 3-4 seconds, if I click the text tool, the cross hairs won't come up for 3-4 seconds, etc. It has been like this since I installed it...I am just finally getting my full of it.
I know flash know some Actionscript... to be clear what I know is how to take code form a sample file, and build the gui ontop of it... simple stuff not too tech... ie like moving an object onEvent using AS etc.
I have never taken any programming courses I am a university grad with a good amount of math knowlegde and solid (so I'd like to think) design sense. What I would like to know is two things.1. What methods (if any) would I take to become a proficient AS developer.
2. How long will it take (I can basically devote 6 out of the 7 days of the week to this effort.
5 days. ... can it be done in one 4 month semester?
I have just been asked to do a project that i can do it in flash cause of its interactivity and graphical comunication and so on... its like an interactive map, VERY interactive. BUT, came the question of how long more will Flash survive after the HTML5 and the discontinuing of flash player for mobiles.Does it worth it doing it on Flash or should i move to something else?
I'm using Flash to create a simple profile on a recording artist for work. I'm trying to embed a minute-long .mov file into Flash, so when someone clicks the "watch" button I created, it changes frames and plays this .mov file.
I have everything uploaded, but the .mov file only shows up on certain computers when someone actually clicks the "watch" button. It works on my Mac, a friend's Mac, but on the three PCs I've tested, it won't show up. The Flash file itself works, but the .mov file won't show up on the frame when it is accessed.
The flash file containing the .mov is embedding onto a .php page made in Dreamweaver. On all computers, when the .swf is accessed directly, the .mov file will work properly. On the PCs, when the .php page is accessed and the Flash loads, the .mov will not load.
Here are the links:
[URL]
- Click the "Watch" button on the Flash page when it loads. The .mov file should automatically load there.
Whenever I launch the Flash application or try to save or load a file, I get the "beach ball" for 30-60 seconds, sometimes a bit longer.I have plenty of disk space, plenty of memory.I'm on a 8 core Mac Pro with 10GB of memory, so I don't get it. It should load instantaneously just like Photoshop and In Design do.
I'm developing iOS app and I include huge of file list as Included Files on Air for IOS publisher.But I found a bug. When I insert more than 73 external files to compile for iOS - Flash return error:
During my investigation works I understand - this error do not affect ADT tool for compiling iOS or Android. When I include many files to project - all this files sends as parameters to external file adt.jar.But flash can't send huge amout of parameters.
I googled this issue and found - any other app can have this bug looking on wrong parameters sending options.this is only Flash CS5.5 bug, not ADT. How I understand this? I can use command line for compiling with all this parameters and command line compile succesful.
I'm running the latest build (I'm pretty sure it's 1.0) on Ubuntu and I am calling a function on an amfphp service on another server. Everything seems to be in order, but I am getting a strange return value using the following code:
String url = "http://path.to.our.server/gateway.php"; RemotingClient client = new RemotingClient(url); Object[] args = new Object[]{"Hello world!"}; Object result =client.invokeMethod("service.manager.say", args); if(debug) System.out.println("return from server: "+result.toString());