Flex - How To Wait For Event To Finish
Mar 13, 2011
I have a child component that dispatches an event in Parent. The event in parent makes a call to our database. Right now, the event gets fired off & the child continues without the results. How do I make it so that the child waits for the results from the database b/f the child continues?
in child:
<fx:Script>
<![CDATA[
dispatchEvent(new Event("getDBcontents")); //
dispatch the event in the parent do some more stuff here but we need pause until we get the result from the parent
[Code]...
View 1 Replies
Similar Posts:
Jan 10, 2006
I have a timeline with 20 simple animations and different lenght audio clips that explain each. Is there a way to hold on a frame until an audio clip is done? Currently I have a script that loops a frame for "x" seconds then goes to the next frame. I input "x" each time by looking at the audio clips time length, but I was hoping to create a script that did this automatically.
View 5 Replies
Aug 19, 2009
I have a actionscript file and it tells a function in another actionscript file to run.How can I add an event listener to wait for the function to complete in an external file.
View 9 Replies
Mar 18, 2011
I'm developing an ActionScript 3.0 app for Blackberry Playbook. I have twelve images loaded with a Loader class. I use Event.ENTER_FRAME to fade in and fade out images using this event handler:
private function onEnterFrame(event:Event):void {
imageToFront.alpha += 0.1; // slow fade
imageToBack.alpha -= 0.1;
if( imageToFront.alpha >= 1.0 ) {
imageToFront.alpha = 1.0;
[Code] .....
I have the following problem: If user clicks on another image before the previous image hasn't reached to alpha = 1.0 it lefts that image with an alpha less than 1.0. In other words, I have to make something to left onEnterFrame function set alpha to 1.0. I have tried with stage.hasEventListener(Event.ENTER_FRAME) but it doesn't work.
View 2 Replies
Jul 14, 2009
What I'm trying to do is when I click on a button, the Tween will scroll to screen to the left and play a video. But if the user clicks on the button again before the tween is done, it seems that the event is being catched twice and will screen to the left twice and play two video instead of one.
View 1 Replies
Jun 12, 2009
How do tell my parent class to wait for a subclass Timer finish event? Here is my "Timing" subclass:
[Code]...
View 4 Replies
Feb 19, 2012
I'm using a spark list to render data which I get from a web service.is there an event which fires after the list has finished rendering all the data ?I want to show a loading image to the user until the list finishes.
View 2 Replies
Feb 22, 2009
My program reads a rather large data file that is crucial to the display of the program I am making.I have an event listener that waits for my loader to load all data from the file, and it then adds all the data (and parses it) to a 2d array.Unfortunately the program flow doesnt wait for the loading to finish, so when it checks the array, it is still empty because nothing is loaded into the array yet.
View 9 Replies
Jul 7, 2011
I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript's ENTER_FRAME. Basically, I want this event listener to listen "all the time" not just wait for any particular instance (mouse click, keyboard event) of event.
View 3 Replies
Aug 1, 2011
I'm new for flash. I would like to know I need to fire what event which can detect frame animation finish? I need to pass a parameter from swf to flex to inform frame animation finish.
View 2 Replies
Feb 2, 2010
I'm working on an mp3 player. I want to trigger an event when the track finishes playing. I've created a function that will just trace a statement so that I know the event listener is working, but I can't seem to get it to trigger. Here is the playSong function in which the code is used:
Code:
function playSong(mySong:Number):void {
var myURL = my_songs[mySong].@URL;
playingTra = mySong;
current_song = mySong;
my_sound = new Sound();
[Code] .....
I tried to add in the following lines, but that instead institutes some playback issues:
Code:
if (my_channel){
my_channel.stop();
my_channel.removeEventListener(Event.SOUND_COMPLETE, stuff);
}
View 3 Replies
Dec 3, 2009
I'm using the Actionscript Timer class. What happens if I run a function every 3 seconds, but the function takes 4 seconds to complete? Does the Timer object queue up events? I guess this must happen if only 1 thread is being used?
View 1 Replies
Nov 3, 2008
It seems to be the case that the MOTION_FINISH event fires of prematurely in the Flash Tween class. I've heard that it is not the best tween engine to use, but this seems like a particularly egregious. I am using "Strong.easeOut" for the motion. What are some alternative tween engines that people like?
View 1 Replies
Apr 2, 2012
I have the following code
var sender:URLLoader = new URLLoader();
sender.load(post_request); // load the php file and send it the data
[code].....
View 5 Replies
Jan 8, 2010
I am trying to write functions as efficient and reusable as possible. One function in particular I wrote was designed to easily create new objects from externally loaded files. The problem I have is that I can't think of a way to make the function wait for an event listener to complete before returning the desired object. Here is what I have so far and I will point out where the problem is.
Code:
var myNewObj:Object = loadFile(parentName, "swfs/" , "file.swf");
function loadFile(parentObj:Object, urlLocation:String, fileName:String):Object{
var fileLoader:Loader = new Loader();
[Code].....
View 3 Replies
Apr 3, 2010
I have an AS 3.0 class that loads a JSON file in using a URLRequest.
package {
import flash.display.MovieClip;
import flash.display.Loader;
[Code]....
When the file is finished loading, the mapHandler event makes changes to the class properties, which in turn are accessed using the getMapWidth function. However, if the getMapwidth function gets called before it finishes loading, the program will fail.
How can I make the class wait to accept function calls until after the file is loaded?
View 2 Replies
Jan 12, 2009
I have an subclass that is called from the constructor of the main class. The subclass is loading and parsing a .xml file for images. A Event Listener is waiting for the .xml file to load and the fill the image URL's into an array. This code works fine (tested), but here is my problem.
While the subclass is called in the constructor, I also have code that should display two of the loaded images by default. However, while the xml file is parsing and filling the array, the main code already continues on and tries to display the two default images on the stage. But this causes the program to break, because the code executes before the array is filled from the .xml file.
this is the error the program spits out : TypeError: Error #2007: Parameter url must be non-null.using trace I see that it is trying to access the array but its undefined, because it hasnt been filled yet.
Here are the code snippets, concerning that problem.
//Main class code
//the constructor of the main code, which calls the loader class for the .xml
public function GameOfGames()
{
[code]....
Is there any way to make the code in the main class wait for the array to finish filling up before the main code moves on?
View 0 Replies
Jul 11, 2011
I'm embedding a flash object in an html page and calling windows.onload to initialize the Flash movie. The problem is that the windows.onload does not wait for the Flash object to completely load. Is there way to make sure that the Flash object has fully loaded?
Here is the code I'm using:
<head>
<script>
var falshObj = null;
function pageInit() {
thisMovie();
[Code] .....
View 1 Replies
Apr 20, 2010
How do i wait for the entire document class to load before a custom event dispatches.....my problem is it dispatches before the class with the listener is envoked by the "main" document class
View 8 Replies
Jan 22, 2012
The video seeks normally when first playing but when it finishes i canīt seek the video again. I used a listener to call a function after the event TimeEvent.COMPLETE occurs(video finishes). In the function i call the function player.seek(20) for example but it doesnīt work. The video keeps in the end of it.
View 1 Replies
Mar 21, 2012
I want my code to wait for a couple of seconds before executing. So is there any function similar to sleep in flex?
View 3 Replies
Nov 12, 2009
I have a simple component I created which I instantiate in my main program like so:[code]I receive the error "Cannot access a property or method of a null object reference" on the second line because newMessage was not fully created prior to hitting the second line of code trying to set my "body" textarea's text. I know I can build a "creationComplete" event handler, but isn't there a simpler way to do this?
View 2 Replies
Aug 30, 2010
I'm currently creating a website with AS3 in FlashDevelop, so it's code only no timeline stuff.
I have a class that loads images with a method that I call from my main source. I was wondering how I go about making sure that the images are loaded before executing more code outside of the class. I know how to do it using Event.COMPLETE in the image class, but I am unsure how to get the main class to wait.
View 1 Replies
Mar 25, 2011
we're developing an app that should be able to open specified file with default editor application. (so if it is .doc - it suppose to be opened by MSWord or openOffice)
But I also need to wait until user will close the editor, check if it was changed (by size and date), and upload it to the server.
So the following steps:
1) find def editor
2) open file
3) wait it be closed
4) do smth after that with the file.
now results of my research:
-> opening by def editor is simple: file.openWithDefaultApplication();
but there is no way to know that editor is closed (maybe by checking that file is not locked in timer???)
-> i can start the native process and pass file as parameter BUT looks like the code NativeApplication.nativeApplication.getDefaultApplication(file.extension); does not work for any extension :( - it doesnt work for "rtf", "doc" but works for "pdf"... and [file.openWithDefaultApplication()] works fine with any file!
View 2 Replies
Jun 22, 2011
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 Replies
Jul 8, 2009
My Flex application does a remote call to weborb to save some data from Flex. When this data is saved, a service is called on another server. All this time Flex is waiting for an answer. Is it possible to call this service (on the other server) and not wait for an answer. I have tried to call the service asynchronous but all this does is calling the service in a different thread. Flex still has to wait for both threads to be finished... So when the data is saved, flex should get its answer. (while the thread handling the service is still running).
View 2 Replies
Mar 8, 2009
If I have code:
Code:
Alert.show('Please respond');
request.send();
In this code, flex will pop alert to screen and immediately send out the request. How do I wait until user clicks ok on the alert and then send out the request?
View 1 Replies
Sep 16, 2011
how can I load in flex spark Image control and wait for complete loading? MX:image have method load() and listen COMPLETE event this is not in spark Image...is there only source?? or how can i listen when image is complete loading??
View 1 Replies
Apr 12, 2011
I have editable grids which are 2-way binded to my model. What I want is to validate my data when user edits any cell before it get updated in model. I have applied my validation at ItemEditEnd handler, but, I want to apply validation in between itemEditBegin and itemEditEnd events.
View 1 Replies
Sep 6, 2011
I've created a Flex website that plays a video using the Spark VideoDisplay component. When selected, the VideoDisplay loads in the PopUpManager.
This works fine in all the browsers, except Google Chrome take significantly longer to start playing, during which the CPU usage peaks, then goes back down once video starts playing.
I've traced the player states it goes through and they are as follows:
Loading ready (hangs for ages with high cpu) buffering playing (immediately after buffering, CPU usage goes down, video plays smoothly)
What could be causing this to temporarily hang for so much longer in Chrome? I thought I could expect the same functionality and behaviour throughout all the browsers, as Flash is simply a plugin that runs as a separate process?
Edit: It seems that it's the same in Opera too. Is there any commonality between the two that would explain this behaviour?
[Code]....
View 1 Replies