ActionScript 3.0 :: Verify Image File Path Before Sending It To URLRequest/URLLoader?
Feb 12, 2011is there a way to verify that an image file exists at the stated URL before passing that URL to various URLmethods?
View 0 Repliesis there a way to verify that an image file exists at the stated URL before passing that URL to various URLmethods?
View 0 RepliesI have a scheduling application that allows users to save any changes. When the user clicks the save button, Flex sends all the information to a coldfusion script which picks the information apart and sends saves it to the database. That all works well and good, but I would like to be able to display some sort of text to the user saying something like "Your file was successfully saved" or "There has been an error.
[Code]...
What is the difference between URLLoader and URLRequest in Actionscript?
View 1 RepliesI need to parse a particular web page every 25 seconds in order to take some particular values that are frequently updated in this web page. I need the parsed values in order to dinamically fill some text inputs components. So I write the following script:
Code:
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
[Code].....
With this script I'm able to get the webpage and parse the particular line of code that I need but only the first time! When the timer goes to zero the URLLoader function always loads the first version of the webpage and not the one that has been updated in the meanwhile! So I have always the same values! Using the trace function I have discovered that URLLoader loads the first version of the webpage. I don't know what is the problem here. Cache problem? URLRequest or URLLoader problem (maybe I have to clear the previous data?)?
I am building a simple swf that will load in variables from an asp page using a URLloader and URLRequest. The asp page loads in the current values from a SQL database but these values will change every second. My swf loops every 6 frames and loads the data. How much load this puts on the server? And when the server is busy might this cause a problem with the variables I am reading in?
Does AS3 run all actions on frame 1 before going to frame 2 etc? I don't know if this is the best way but my last variable in the ASP page is called Loaded and I test for it before moving on. My major concern is the load I am putting on the website but is this small? In firefox the status box constantly flickers transferring data from ... and waiting .. but in other browsers you can't see the activity.
there you are, you set up your AS3 code to load XML via a URLLoader and URLRequest, as normal. You then take your XML file, and upload it to a server. You then run your program, and trace out the XML you receive. So far so great, and you see the results of your XML traced out. Then you change something on your XML, either adding to it or removing a line. You then run your program again from CS5.5, and trace out the XML, and it shows the same results that it did before you made any changes. I deleted the XML file from the remote server, and it is like it stored it in cache, and still able to read it. If I change the url or file name, it gives me an error, which it should.
If I point the url back to my remote XML file, and run the program again, it gives me the XML results I had in the beginning, before I made any changes to it (regardless if the XML file exists). The only fix I have found so far, is closing CS5.5, and reopening, and then it can see the changes. I did that, and it was able to see my XML changes on my remote server, but again, only one time. If I try to change anything, or delete the XML file, it still pretends as if its there, reading the results that it read the first time I run the program. Is this a cache issue? Anybody else experience this? I never remember running into this problem using CS5/CS4/CS3, only CS5.5. Of course, I can test it all locally first, and then upload the XML file to the remote server when I know that no other changes need to be made, but still, this is really weird!
Peek-a-boo, me again. I'm having some trouble with loading in a txt-file and I can't figure out why, as it works in a new .fla file as well. Here's the code in a nutshell:
PHP Code:
goldstar.addEventListener(MouseEvent.MOUSE_DOWN, showHS);
var weekrequest:URLRequest = new URLRequest("weekscores.txt");
var weekloader:URLLoader = new URLLoader();
[Code]...
I have written code to read an XML file by using URLRequest and URLLoader in ActionScript 3.0. Code is pasted below. This runs well in AS3.Problem I am facing is because I wrote this in AS3, I am not able to use the DateChooser component in another part of the flash module because it seems like DateChooser component is not supported in AS3. So I want to migrate my below AS3 code back to AS2.
**** Code in AS3 (I need help in writing equivalent code in AS2) :-
var xmlText:XML ;var xmlReq:URLRequest = new URLRequest("myFile.xml");var xmlLoader:URLLoader = new URLLoader();
So let's say we want to load some XML -
var xmlURL:String = 'content.xml';
var xmlURLRequest:URLRequest = new URLRequest(xmlURL);
var xmlURLLoader:URLLoader = new URLLoader(xmlURLRequest);
[Code]....
I hate that you can't just say e.target.src or whatever - is there a good way to associate URLLoaders with the URL they loaded data from?
I am trying to setup two variables:
var xmlURLLoader:URLLoader = new URLLoader();
var xmlURLRequest:URLRequest = new URLRequest();
I am taking some old AS code and trying to plug it into Flash Builder. I am getting a "Type not found."warning with those variable declarations. Does anyone know which package to import?
when handling data, i always have to write the following:
var dataSourceRequest:URLRequest = new URLRequest("/path/file.xml");
var dataSourceLoader:URLLoader = new URLLoader(dataSourceRequest);
dataSourceLoader.addEventListener(Event.COMPLETE, handleDataSource);
while i can understand the usefulness of these 2 objects and event listener being separate, since they often work with each other i'd like to know if there is a method that will combine them all? the closest i can get is this, but it's a bit pointless/nesting:
var dataSourceLoader:URLLoader = new URLLoader(new URLRequest("/path/file.xml"));
dataSourceLoader.addEventListener(Event.COMPLETE, handleDataSource);
what i'd really love would be something that automatically combines the URLRequest, URLLoader and completed event listener like this:
var dataSource:Whatever = new Whatever("/path/file.xml", handleDataSource);
I have a queue of messages that I would like to send to a URL and I would like to remove messages from that queue only after I am sure they have been successfully sent. To do this I need to know in the COMPLETE event for the URLLoader exactly what data was sent so that I can remove the correct message from the queue.That is if I have something like this.
var urlRequest:URLRequest = new URLRequest(targetUrl);
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
[code].....
I am trying to send a server "schooltraq.com/api/" variables for a request.My Code:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.*;
[code].....
How ever when I keep getting back "error:empty request". I emailed the site owner and he said that my program may be dropping the data during redirects.[URL]
I'm trying to load XML data from a PHP file. How can I send data to the PHP file in the same request before I load the data?
ActionScript Code:
var loginXML:XML;
var loginVars:URLVariables = new URLVariables();
var loginSend:URLRequest = new URLRequest("savexml.php");
var loginLoader:URLLoader = new URLLoader;
[Code].....
I am working on a flash website that loads live inventory data from a public csv file publish by google docs. the csv file is located at a public address on google docs server:[URL].. I am using a URLloader and URLrequest within my flash movie to grab this data and assign it to different variables.
It works great when I preview the movie in flash. However, when I go to publish the movie and preview the html file its loaded into in dreamweaver, I get a security warning from adobe flash player: Adobe Flash Player has stopped a potentially unsafe operation
I went ahead and published the html file that contains the swf file to the web, and when I go to my site, I don't even get the flash player warning; it just sits there like its trying to load the URLrequest and never completes.
I understand that flash player has a security measures that prevents flash files from accessing files outside of the server directory that the swf file is published to. I know you can create policy xml files to tell flash it's okay to load the data, but those policy files have to be located on the public server from which the data is being grabbed. But it's not like I can waltz on to google's servers a stick a policy file in there!
Is there any way to tell the flash player it's okay to load this data without getting that security error? I can't have the end user having to go into their flash settings and adding the location manually. I just need it to work without the security warning.
Is there another method of loading data from an external server without tripping up flash player security? aka, something other than URLloader and URLrequest?
[Code]...
fla files which is calling default page . but it's not able to find the default page.. my default.aspx page is in root directory ,and my fla file is in ../capture/image.fla . here is my code
[Code]...
I'm in flash cs3 project. I need to create a pdf file from an image path included into an xml file or if easy also in a written path as the code below:[code]
View 0 RepliesI am facing some issues sending byteArray as part of my URLRequest data to a cfm page.I need to send an collection of objects as part of byteArray.But when i try doing so,i get illegalArgumentException.I am doing it this way
var obj:Object=new Object();
obj.name='Mike';
obj.age='26';
var byteA:ByteArray=new ByteArray();
[Code].....
Secondly when i tried sending xml obj as part of ByteArray,It worked fine ,but i get unwanted characters appended at the start and end of the xml.
I'm trying to send about 1 MB of binary data to server via URLLoader. But when I call method load of this class, my application hangs for about 1-1.5 seconds, then uploading runs normally. How can I prevent it?
View 2 RepliesI am trying to import an image path from a xml file. I can trace out the correct file name but I can't seem to load the file into the holder.I get this error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I presume there's something else I need to add to the XML syntax.
Code:
// HOLDER:
var LoaderImagesMC:MovieClip = new MovieClip();
// LOADER:
[code]...
How to retrieve xml data in an aspx page after sending it using URLLoader.load
This is the flash code i am using:
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; //tried by giving VARIABLES also urlLoader.addEventListener(Event.COMPLETE, handleComplete);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
[Code]....
I were able to accept data in above statement when i send a string in var1 say "test". But on sending xml above error is getting.I have tried to load the xml data in XMLDocument also.
In AS20 i used sendAndLoad method to send and reterive xml data.
I have done some coding in the past in .asp .aspx, but it is not my primary forte. I am working on a site that has a page for project photo galleries, and have been following a lot of the tutorials from this site. I have a directory structure as follows:
root folder (containing projects.swf) --> projects directory --> project1 directory(containing image files, thumbnail images, and images.xml)
For testing purposes, in projects.fla, and resulting projects.swf, I have:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
[Code]....
how to code projects.fla with the correct path to the .xml file in the <root>projectsproject1 directory, and ideally, a way to make it dynamic so I can pass the path to the projects.swf file using a variable, and be able to direct the movie to use the intended xml file, thumbnails, and images based on the press of a button contained in a projects menu. Unless I have missed something, all of the tutorials I saw had the images and .xml file in the same directory as the .swf.
i have imported an image using actionscript using urlrequest.i have set its x and y bu the image is to big, i want to resize it, i have tried the height and widt but it doesnt work
View 2 Replies how to check whether the URL given to URLRequest really exist or not? for e.g.,
var a:Loader = new Loader();
var b:URLRequest = new URLRequest("C:/123.jpg");
now here, how can I check whether the URL given to variable " b " is really there or not?
var a:Loader = new Loader();
var b:URLRequest = new URLRequest("C:/123.jpg");
a.contentLoaderInfo.addEventListener(IOErrorEvent. IO_ERROR, error);
In my movie i have a link button with following, simple, function creating a link:
[Code]...
lately i've associated a class file (.as) to my movie and immediately after, when publishing the movie i got the following error message: 1046: Type was not found or was not a compile-time constant: URLRequest. as well as a couple of other related error messages: 1180: Call to a possibly undefined method URLRequest. 1180: Call to a possibly undefined method navigateToURL. when i remove the link to the class file, the problem goes away. also, i have checked the class file for mentioning of "URLRequest" and nothing is there.
i want get ByteArray of image file with URLLoader class.
PHP Code:
var byte:ByteArray=new ByteArray()
var loader2:Loader
var loader:URLLoader=new URLLoader()
[Code]....
HTML Code:
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
i can make this with Loader class but i want make with URLLoader class!
I'm loading images via a URLRequest and Loader classes and I want to manage the image when the request is complete. The example below doesn't fire the event when it is complete. The same code would work find for a URLLoader, but not a Loader object. Basically the image loads and the event listener is never fired. Can anyone tell me how to get an event to fire when Loader finishes loading an image.
var imageReq:URLRequest = new URLRequest("http://www.google.com/images/nav_logo29.png");
var imageLoader:Loader = new Loader();
[Code].....
I will use the URLRequest to upload the modified image in Flex. It works fine. However, I need to add Content-Length as a URLRequestHeader for the moment, and I get error 2096. Then, I know that this header is not allowed.
Update:
According to adobe's documentation:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequestHeader.html[code].....
want to get the loaded image path location,how to get the path
<mx:Image source="@Embed('assets/image001.png')" x="240" y="41" width="148" height="118" id="img"/>
i need to get this address source="@Embed('assets/image001.png')" how?
var req = new URLRequest("submit.php"); I want to do that for either localhost or the remote host, using the same code. As written, it will read the raw php as a file. If I insert a host name and protocol:
[Code]...