ActionScript 2.0 :: Waiting For A MC To Stop Before Continuing?
May 18, 2007
I have an animation stored in a movieclip.I have 5 instances off this mc stored off the stage. Whenever the user enters a wrong response, one of the mc's play a walk animation and a person 'walks' onto the screen. After moving 80 pixels, an if function in the onEnterFrame deletes the onEnterFrame.However, if the user enters more then 5 wrong answers, the persons start a new animation. The problem is that if the user gets a question wrong before the person has finished moving - the person stops and does the new animation.
Thus I was hoping to use setInterval after a check to see if anything is moving. Yet it doesn't see to work. My traces show no delay between the interval trace and the trace after the interval.Here is a section of my code; basically when k = 6, the fifth person has been called previously and the moving variable is a boolean set to true. But when run, there is no 20 second delay, it just says 'slow' then 'delay' and then kicks into the final animation.
Code:
if (k > 5){
trace(person5.moving);[code]....
View 2 Replies
Similar Posts:
Jan 20, 2010
I have two problems:
1. Despite lots of searching/reading, i am still not sure how to listen for the end of a function in a child class from a parent class.
2. Building on question 1, I need some thoughts on best practices for halting execution until a number of events are met.
E.g. I have a class 'ContentBrowser' that instantiates a variable number of 'StuffList' classes. Upon instantiation of a 'StuffList' class an xml file is loaded for that instance. So I could have 4 or so xml files loading at once. What is the best way to wait until all the 'StuffList' instances have been loaded and parsed before continuing execution of my code within the ContentBrowser class?
View 4 Replies
Sep 14, 2009
I have been on countless Flash forums, reading hundreds of posts with varying degrees of suggestions all of which leave me without a solution. Posts have been floating around regarding this topic for almost a decade now, and nothing seems to get resolved. So I come directly to the source. First off, here's a description of the problem. I am not the designer. The designer is very purposeful about the font styles, sizes, colors, etc, that he select. So to even consider bastardizing his work my substituting in any of these godawful "Fonts For Flash" would be inconceivable and potentially jeopardize my job. (Not really, but he is very passionate about his work... and who am I to question the master. What is baffling to me is if you watch the animation closely, the text is actually clearer during the movement... but as soon as the animation ends, that's when the text turns fuzzy.
[Code]...
View 3 Replies
Feb 2, 2009
I am using set interval. I can clear the interval to stop it, but when I use the play(); command it continues from the beginning and I want it to continue from where I left off. The timeline is 10 frame long. I want to continue from a specific frame. I already tried gotoAndPlay (frame#) and it doesn't work. Maybe I had it in the wrong place. I bolded the area that needs some sort of code, somewhere within/below it.
Here is the code.
frame #1
//SET INTERVAL
stop();
callback1 = function (){
if(_currentframe == 10){
gotoAndPlay(1);
clearInterval(ID);
[Code] .....
View 9 Replies
May 23, 2010
I have created a countdown timer from 60 seconds.I tried copy and pasting it onto the next scene, but it starts from 60 again.How can I make it continue from it's vaule on the previous scene?Here is the code I use to create the countdown timer:
ActionScript Code:
timer = 60;
countdown = function () { timer--;if (timer == 0) {clearInterval(countdownInterval);}
[code].....
View 9 Replies
Jul 7, 2011
I have a site with a music player that streams the music. On the site I also have a button that opens a video page. When I press the button, I want to pause the player. That works, except when the player is loading or buffering, I cant pause it. So I want to put something like this on the button...
on (release) {
if audioPlayerStatus = "loading" or "buffering" {
WAIT a bit and check again
} else if audioPlayerStatus = "playing" {
audioPlayer.pause();
}
The status function is bulit into the player. "wait a bit" code.
View 1 Replies
Jul 19, 2007
I have this function that has a loop in it.[code]How do i get it to hold until col_mc[name] has reached frame 80 in its timeline?So it loops then waits for the movie to get to frame 80 before carrying on.
View 6 Replies
Mar 29, 2010
Is it possible to wait for a response from a URLLoader before continuing execution of code? Yes, I know it's not directly possible, but is there any workaround?
[Code]...
Also a "No, Andreas. For the n-th time, it's not possible!!" reply is acceptable rather that no response.
View 2 Replies
Apr 19, 2011
I want to be able to throw an error to be traced to the trace output window and to my flashlog.txt file but continue code execution after the error. Is this possible in Actionscript 3? A try catch will not work either because I need the error to be logged with its call stack.
View 2 Replies
Jan 5, 2010
I am trying to read an XML file from a class, (I'm fairly new to OOP, I got the concept, how to use them and all), I want to do everything without having to break down my code to segments in a gazillion frames, so I work from the documentclass. I need to
1) load XML
2) wait for it to be loaded
3) Start working with the XMLdata
So I made a class 'queryXML' where I do all the loading, and in my Main class I setup the instance of queryXML and tell it what file to load. Now everthing runs fine, BUT i don't know how to wait in my Main-class until loading is done. My queryXML class holds a status variable and I have a method to check it.
[Code]...
View 5 Replies
Mar 13, 2010
The problem I have is that the amount of elements in my XML is variable, and I need to initially place objects on the stage depending on the data in the XML file. Both how many objects to place and their positions are in the XML file. I can't get it to wait until it's looked at the XML file before continuing through my code, obviously erroring when it doesn't know how many there are. It gets through all my code before finally coming back to run the function to grab the XML. I have tried putting setting a variable within the function, and a while loop outside the function waiting to that variable to be set, but it never happens if I do it this way.
Code:
var items:Array = new Array();
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, handleXMLLoaded);
loader.load(new URLRequest("[URL]"));
function handleXMLLoaded(e:Event):void {
[Code] .....
View 2 Replies
Dec 13, 2011
I am trying to make a 3-dot waiting animation using action script.
I want it to go until three dots "..." and than start over again until I manually stop it later in my program. I tried many stuff including arrays and surrendered.
View 4 Replies
May 3, 2006
I have this bit of actionscript that tweens a movie in position and scale. It then attaches a movie from the library.
Code:
_root.info._alpha = 100;
_root.info.slideTo(20, 100);
_root.info.window.tween(["_xscale"],[140],1);
[Code]....
Whats the best way of waiting until the tween is complete before attaching this movie. Basically I want the attached movie to appear once info._x == 20.
View 5 Replies
Nov 15, 2007
I'm using a custom class to lay out a background consisting of square tiles picked at random. These are provided to the class as an array of library symbols, and they are placed on stage with the attachMovie method.- These tiles are different animations that all end up in a solid colored square. When all the tiles have finished animating, the result will be a large rectangular shape that serves as a unified background for content like text and graphics, so I't simply a sort of fancy build animation for the background.
- Naturally, I don't want to be displaying content before the animation has finished, so I need to do that based on some kind of event being dispatched. The problem is that these animations are timeline-based and I want my class to know when all background clips have reached their final frame.The question: How should I do this? Extending MovieClip for each of the animations seems a bit tedious since that would require one class per background tile MovieClip, and I don't want to be constantly checking the currentFrame of all the clips either.
Code:
public function TiledBackground(target:MovieClip,
bgSymbols:Array,
[code].....
View 5 Replies
Jul 30, 2009
I am creating a site where it is loading dynamic images and text within the SWF. Currently for images I am using the loadMovie command. This works typically when I do not have images of significant size, however I am having trouble getting the movie to check up if a larger image needs to be loaded. Here is my current code below, it does not seem to be checking to see if the clip is loaded and simply ignores it if the timeline reaches the actionscript before the image is loaded. _root.generalVars.homeImg is a variable that I define outside of flash
//creating empty placeholder
this.createEmptyMovieClip("tester",1)
tester.onData=function(){
[code]...
View 2 Replies
Nov 23, 2011
I have an arbitrary number of images I want to load. I want to load them, wait until I get an Event.INIT for each, and only then proceed with the rest of the program. I know I can do that by having an Event.INIT listener update and check some count variable, but is that the standard approach? Is there a more elegant or AS-specific way?
View 3 Replies
Feb 23, 2012
var playGraph = new Chart();
var playPart1 = new Part1();
var playPart2 = new Part2();
[code]....
View 1 Replies
Feb 15, 2009
i have an animation with a series of colored squares appearing and disappearing from the stage [URL]..except that the squares appear and disappear). Each of the squares fade in and out using Actionscript, with a custom method that animates its alpha property over time. I want to pick randomly every few seconds a square, to make it disappear and put a new one in its place, and my code is more or less like this:
[Code]...
View 0 Replies
May 14, 2007
I'm looking to pause on frame 1 of a movieclip for a random amount of time before playing frame 2 and the rest of the movie. This will thus repeat and the movie will play at random intervals.how to set this up in AS3 format. how do i convert this simple line of AS2 code into a working piece of AS3 code?
ActionScript Code:
Stage.showMenu = false;
View 13 Replies
Jul 29, 2003
Anyone know how or have any ideas on how to tell flash to wait for a "x" number of frames or time before it executes the next line in the script?
View 1 Replies
Jan 18, 2010
I am sure I will receive the beginner question of the year with this one: Just starting w/ Flash 8. Using AS2 to simply make a graphic (and its clickable area) proceed to next frame when clicked. When input : button.onRelease = function() { gotoAndStop(2) the movie proceeds to Frame 2 without a pause for the click event. I have tried a stop(); prior to the above function, but no action after click. Basically trying to understand why frame 1 with the event handler AS does not pause to accept the mouse click?
I apologize for such a basic question, but my eyeballs are bleeding from trying to figure this out.
View 1 Replies
Jan 26, 2005
how can i tell after waiting for 1 minutes go to and play frame 1 in acionscript.by the way i am using flash mx.
View 8 Replies
Feb 3, 2010
Using Flex Builder 3 : I have been getting this problem in every single debug launch for past few hours. I used to get this earlier too, but once in a while, not with every debug launch. I found out that flex debugger uses a certain 7395 port but I can't figure out how to change it?
View 9 Replies
Feb 5, 2011
Certainly it is not the best practice, but I need to load a file and get its contents within the same function call. That is calling the urlLoader.load function and then waiting (say with an while(true)) for the contents to load.
I am stuck with the fact that flash will not trigger events nor continue with the file loading until the current thread finishes. Is there any way to allow flash to make the file contents available without exiting the current method call.
On a side note, I know this is not a good thing to do. This is only for easing a process in a local environment in which I need the file contents without waiting for an event. If I let the process continue other events already queued will fire and becomes a mess. Sadly refactoring the code to wait altogether would be too much effort.
View 2 Replies
Dec 21, 2011
I'm getting really annoyed by Flex. Is there a way to make it wait for an httpservice to get its data without having to use a timer?
At the moment my code looks like this:
protected function loginUser(event:MouseEvent):void
{
if(txtEmail.text == "" || txtPassword.text == "")
{
[Code].....
When I do user.login(), it sends a request with a HTTPservice from my external AS class. In the result event handler for this httpservice, I set a public variable to true or false, depending on whether the user's credentials are correctly in the DB.
I then use a getter to get that boolean value. However, without the timer, it always returns false because my code is faster than the event result handler. If that makes sense.
So I have to use a timer to stall my application for one second.. But seriously, that doesn't make sense to me. There has to be a better way, no?
View 3 Replies
Oct 25, 2005
Is something wrong with this code? I am trying to tell Flash to wait to call generateEventClips() until timeline_events.swf has been fully loaded into events_mc. But I don't think it is doing so, because the clips that the function is supposed to generate don't appear unless i call the function at least two frames later.
var events_mc = new MovieClipLoader();
events_mc.addListener();
events_mc.loadMovie("timeline_events.swf");
events_mc.onLoadComplete = generateEventClips();
View 3 Replies
Jun 23, 2010
what is probably a basic question...I have a Flash app that needs access to the microphone. The code is:var mic:Microphone = Microphone.getMicrophone();That initiates a dialog box where the user allows or denies use of the mic. What I was to do is have my code pause at that point, and not proceed until after the user has made their choice (allow or deny). I assume there's gotta be an easy way to do this, but I haven't discovered it.
View 4 Replies
Oct 8, 2011
DISCLAIMER I've just started to learn flash to fulfill a class assigment. This problem probably has a very easy answer, but I can't find it and now I'm getting close to my deadline.
PROLOGUE The title describes what actions I'm trying to put in a button. I'm making a quiz. Each keyframe has a pic and 4 buttons. The correct answer should show a green V onscreen; the wrong answer should show a red X. After one second, it jumps to a new question in a new keyframe. I've made the X and V as both 12-frame movieclips and 1-frame graphics on the library, but can't seem to make them show up correctly.
1st issue: showing the movie clip/graphic. The movieclip/graphic should appear in the center of the stage *after* you press the button. Currently, the clip is there from the start; can't find a way to make it start invisible, then visible when I click the button. 2nd issue: waiting 1 second before going to next frame.I've tried using setInterval, but failed. Maybe the best way is to use a command that waits for the movieclip to play before making the jump?
[Code]...
View 6 Replies
Mar 19, 2012
Here is an excerpt of my XML file. (It is properly formatted, and has a root node, etc., but is too long to post the entire thing. Below is just the part I am concerned with.
<question id='Q1' uId='99036' no_ans='2' txt='In a flat structure employees are not expected to provide their bosses with their opinions.' feedback='' type='MC' passingWeight='1' url='media/'>
<answer id='Q1A1' uId='311288' txt='True' weight='0'/>[code]...
What I now need is a way to grab the txt attribute value from the answer tags and be able to access them from anywhere in the fla. Keep in mind that there are two answers for every question. ie:
< answer id='Q1A1' uId='311288' txt='True' weight='0'/ >
< answer id='Q1A2' uId='311289' txt='False' weight='1'/ >
View 1 Replies
Feb 6, 2010
I have a flash file that is 1.5mb in size. As it takes about 6 minutes for someone on dialup to load this file, I have created a smaller swf file and loaded the larger one from it but I don't want the larger one to begin to play until it's fully downloaded. How do I set this up? I have set up the action script 2 as follows: loadMovieNum("top2.swf", 0);
View 7 Replies