Actionscript 3.0 :: Cancel Loading Operation?
Jun 24, 2009We have this
Code: Select allvar ldr:Loader=new Loader();
ldr.load(new URLRequest("1.jpg"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, comp);
[code]....
We have this
Code: Select allvar ldr:Loader=new Loader();
ldr.load(new URLRequest("1.jpg"));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, comp);
[code]....
I am getting some strange results while loading large files dynamically, and testing my movies. Even if I delete the object in which the external file is loading, the bandwidth of the loading seems to continue. Either Im not doing a good job of cleaning up after myself, or the test environment when exporting a movie isn't accurate, or ... there is no way to cancel the effects of
[Code]...
Is this going to be the case online? (difficult for me to test right now) Is there a way to break off the loading once it has begun? (I thought by deleting the object that called the loading function, I would end the loading)
I can't seem to get a MovieClip loaded using the MovieClipLoader.loadClip method to cancel.I try calling the loader's unloadClip method, but that does not do the trick. Also tried simply using the unloadMovie method on the actual clip instance but that didn't work
View 1 Replieshow do you tell a loader to stop / cancel what it is currently loading? (or is it even possible?) i have a set of navigation buttons, which when clicked, will load an external swf on to a movieclip called "pagesHolder" thats on stage... this works fine, i have even added...
[Code].....
to make sure that only 1 swf can be seen at a time and they wont overlap each other when you click on the different buttons... however, when you click on another button before the previous swf finishes loading, then you will begin to have problems.. it will load another swf, without first cancelling the previous swf from loading.. and this can be seen in the bandwidth profiler(the items being loaded begin to stack up as i keep clicking on the buttons again and again)..
below is the code im using.. ive omitted the unimportant parts... the loadPage function will begin when a button is clicked...
[Code].....
I am having a problem with loadMovie(); I have a button that loads external SWF into a container, but when another button is released loading a different SWF into same container, that SWF twitches and doesn't load properly.Is there a way to cancel an external SWF from loading during the load process? Or is there an easier way to prevent this using onLoadProgress(); with a while loop?And I am some what new to listeners and loadProgress(); programming
View 4 RepliesI have started working with Flash MX again and I am making a presentation CD.
I have a dynamic text field and a menu with buttons. Some of the buttons tell the dynamic text field to load data from online files, and some load it from offline files (which is obviously quicker).
The problem i have is
-I click Button 1, which loads online data
-I click Button 2, which loads offline data BEFORE the data for button 1 is loaded.
What this does is loads the data from button 2 which is fine. But then it overwrites it with the data from button 1 which was taking longer!
Is there some way i can tell it to stop running actionscript for button 1?
I have tried to import a movie into Flash 8 and the message appears "The operation could not be completed as an error has occurred". It will not pu the movie on to the stage. Do you think there is something wrong with the movie file or am I missing a step? This is what I do:
1) open a new flash file
2) file - import video
3) browse to find the movie file and then click next
4) Click the option 'progressive download from a web server'
5) I dont change any of the default settings and I don't want a skin on it
6) It runs through like it is making the file and then the message appears "The operation could not be completed as an error has occurred".
I'm getting the following error when I add a .swf file to my web site. The error only happens in IE. Internet Explorer can not open the site [URL]...
View 1 RepliesI have three classes with names like
-enemy1
-enemy2
-enemy3
and an array enemyIndices = [1,1,2,2,3,1,2] or something like that. Is there any way to compose the class names on the fly so that I can write something like [code]
How do you use the removeMovieClip operation properly? I can't get it to work.
View 2 RepliesHow does one change / modify the Result property of a web service operation?
For example, I have declared my WebService as follows:
<mx:WebService id="ws">
<mx:operation name="Call_One" result="Call_OneRH(event)" fault="Call_OneFH(event)" />
[Code]...
I want to be able to change the result of the operation "Call_One" to another result, since I am planning to re-use the same web service, but the result would be treated differently.
Am not sure if this would work:
ws.operation.Call_One.result = "myOtherResult"
Or... how do you XOR doubles without getting integer results? I am using Actionscript 3.0 and found the following:
var a:Number = 3.000000004;
var b:Number = 29.999999999;
trace ("a: " + a); //3.000000004[code]..........
Clearly, the XOR operation is converting my Numbers into ints. I am a bit surprised by this and don't exactly understand the reason behind it. But I do know that other bitwise operations will also change Number into int, so I am not that surprised.Be that as it may, is there a way to XOR doubles (aka Numbers) without having them get truncated to integers?I used the above XOR originally for performance optimization (these number switches are executed millions of times in an array).I assumed if I skipped the temporary variable, I would see a speed increase.Alas, if the Number data gets changed to int, it is all for naught.
public static function reversePairs(values:Vector.<Number>):void {
//1, 2, 3, 4, 5, 6 -> 5, 6, 3, 4, 1, 2
var l:int = values.length;[code].........
Why does test movie open a new window in the IDE instead of compiling? And when I try Publish Settings I get 'No Valid HTML Templates are available to complete this operation'.
View 5 RepliesI'm running Flash Media Developer Server (free version of Flash Media Server 3.5 for development purposes) that serves as my localhost for streaming FLV files to my SWF media player. When i try to run an HTML file with the embedded SWF file that accesses an FLV on my localhost server, i get this "Adobe FP has stopped a potentially unsafe operation" security message. I tried adding to the location trust list "localhost", "http://localhost", and even specifying the folder and file name e.g. C:Program FilesAdobeFlash Media Server 3.5applicationsvodmediamyfile.flv and http:[url].... Not even System.security. allowDomain ("*"); works which is supposed to allow all domains....
View 2 RepliesI have a random number and a textfield.how to put the result of the random number operation in the textfield ?
function fl_GenerateRandomNumber(limit:Number):Number{ var randomNumber:Number = Math.floor(Math.random()*(limit+1)); return randomNumber;}trace(fl_GenerateRandomNumber(100));[code]....
How do can you detect and dispatch an event when a drag and drop operation ends prematurely? I need to know that the user is no longer dragging an item. Even if the dragDrop and dragComplete events do no fire. Its almost as if I need to add an event listener to the dragManager, but that's not really possible..
View 2 RepliesI have a recursive call which includes an asyn operation (file copy) .. I want to find out when the recursive call finishes (along with all asyn operations).
private function copyInto(directoryToCopy:File, locationCopyingTo:File):void
{
var directory:Array = directoryToCopy.getDirectoryListing();
[Code]....
My problem is quite simple to describe, in flex: 0.8 - 0.2 = 0.6000000000000001 I'm sure the first two members are 0.8 and 0.2 and are Number class, why would this happen?? And another thing, I cast the value from * type like this:
var value:*=0.8;
var castValue:Number = Number(value);
But nothing more, if I trace value I get 0.8 not 0.800000000000001 or something.
I am aware that Action Script does not provide multithreading so when writing flex application we are limited to work on one thread. which is ok for rendering my UI.
However some questions arise when preferring flex over silverlight:
As a UI layer single thread is good enough but is it fair to assume that for Aync httpservice like operations in flex , internally it would use some worker threads to manage the async operation and then come back to the main thread ? it looks like it does since my UI does not freeze.Can the flex/flash player deal with multiple httpservice calls in parallel ? ( e.g more than one section of the UI loading data at the same time.)How about the animation stuff ( e.g the parallel animation ) - does flash player internally leverages some threading for accelerating graphics or is it all done on the UI thread ?
I would like to know how possible it is to undo/redo the resize of the the textflow container through an EditManager?.For example I manually reset the size of the textflow through ContainerController.setCompositionSize(w, h), and then I would like to undo the resize?
View 0 RepliesI have flash form that saves data to csv-file. It worked fine after allowing axtiveX.ut after updating ie to 8 and flash player to 10 (I guess it wasn't 10). The script has stopped working, and I'll get the error "flash has stopped a potentially unsafe operation...".I should probably change the player setting but I'm not sure how. Like some other method besides javascript to save data locallyI managed to get it work by doing it allover again, not sure what was the problem , might be what is suggested beneath, which is funny becouse It was working correcly before...
View 3 RepliesI want to cancel a function (set in motion by a button click) if I click on another button.so lets say I have:
Code:
button1_btn.addEventListener(MouseEvent.CLICK, button1Click);
function button1Click (e:MouseEvent):void {
[code].....
I am working on the Google Calendar API which has been built for Flex/AIR. In the API, for performing a Delete or Update operation, it uses DELETE or PUT methods in the URLRequest. But I think these being REST based calls are supported in AIR. I am using this API in a Flash/AS3 application and have successfully implemented the Update functionality by using X-HTTP-Method-Override method for PUT and instead using POST, which is supported in Flash. But when I try to do the same thing for Delete method, I get a 401 error in the API call.
View 3 Repliesi have some code which (among else) used external interface call and navigate to url.When i publish it in flash cs3 and try to run html from local hard drive i get a warning popup telling me: flash player has stopped a potencially unsafe operation.
View 1 RepliesI am working with videoChat application.Videos are good to display to all.But the voice getting problem.If I speek using microphone(included with headphone set)the voice is echoed.How to cancell it.Presently is there any solution to resolve it, bcz since this is a bug as reported.Any third party softwares are available to work with echo.
View 2 RepliesIs it possible to cancel an RPC call that is assigned to an AsyncToken with responders?
View 1 RepliesWhat do i need to write so that resizing the swf window won't work?
View 2 RepliesIs there a way to cancel a function? I seem to be stuck on my own code. I am using an onClipEvent(enterFrame) to call a function to detect input from the user, to move a character around the screen, and on another layer (but in the same frame) I am calling that function. I want to cancel this 'after' I do a setInterval.
View 3 RepliesI'm developing an app that currently is using Loader to get images from another server.This shouldn't currently work since we are still waiting for the owner of that server to put a crossdomain file in place.However, it does work -- sort of .
Loader can load the images fine, without an error.But then the app has a feature in which we are making a larger duplicate of the image to display in a sidebar, we do this in this manner:
var myBitmap:Bitmap = Bitmap(loader.content);
and when this runs we get a Flash player security error 2122, sandbox violation.So while I'm hoping all this will fix itself when the crossdomain.xml file is put in place,I'm confused as to why we only get the sandbox error when we make a Bitmap from the image, and not when we initially try to retrieve the image.
(Incidentally: is there a better way to make a "copy" of an image loaded by a Loader, and then change its width and height for simultaneous display in another part of the stage? I don't need to change its actual dimensions -- I just need to change its display width and height.)
I have a tree control with a custom item renderer. The item renderer has different states that should be set while an item is being dragged over the item renderer. I understand from reading this post [URL] that the 'right way' to do this is to override the 'getCurrentState' method and append some text. I do that.
Now in my tree control I handle the drag over event and get a reference to the itemrenderer that is being dragged over and I set the boolean 'dragOver' property to true. Now I just need to force my itemRenderer to redraw. I can't figure that out. A workaround, is to just set the currentState of the itemRenderer.
how can I force my itemRenderer to refresh? (and I've tried calling validateNow, invalideDisplayList/Properties/Size, to no avail)
<?xml version="1.0" encoding="utf-8"?>
<s:MXTreeItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code]....