ActionScript 2.0 :: How To Hold On Frame Waiting For Event
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
Similar Posts:
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
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
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
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
Oct 13, 2009
I've got a symbol on stage and a button. The button rotates the symbol CCW half a degree. Code: on(release){ mySymbol._rotation -= 0.5;} I wanna add an on (press and hold) action on button so that the symbol will be rotated continuously when the button is on hold.. I can't make this work for over a week now.
View 7 Replies
Jan 11, 2009
i want to give viewer the ability to hold and DRAG MC2 in MC1 MC1 is gonna be the frame, while MC2 will be some bit bigger than MC1 (the frame), in dimension. And the viewer would be able to HOLD and DRAG MC2's image in MC1's frame. Please guide me with the actionscript required for it ?
View 9 Replies
Jun 21, 2009
How do i make it so you have to hold the button down for a amount of time before going to next frame?
View 1 Replies
Jun 21, 2006
I'm having some problems with controlling my movie clips.
I've got a .fla (flash8) file with a combo box and a submit button. I want the drop box to hold the values of some frame names. On the submit the resutls frame just does a transition between the screens. On frame one there is this code:
Code:
function comboDisplay (component) {
combo = component.getSelectedItem().data;
_root.gotoAndStop("results");
[Code]....
Is there something i need to do to read this as as a string or am I messing up the useage of _root? It wont go to the proper frame after the animation plays. heres a link to a watered down version with only the barebones of the file. [URL]
View 1 Replies
Apr 22, 2009
I'd like to know if there's a wait to have flash hold on a frame till a sound finishes playing. I'm guessing that this will require some sort of EventListener but I'm pretty new to AS 3.0 and I'm not sure how to do it. I've searched the forms but cant seem to find anything on how to achieve this either, but I think thats because I'm not sure of the correct terminology.
View 2 Replies
Jul 22, 2010
Is it possible to grab an event, hold it in a class property, do some action, then, when that action is complete, dispatch an event and then retrieve the original event.target in the listener?I am trying to avoid using a custom event for now, as it is giving me massive amounts of heartburn when dispatching it from a loaded SWF.Here is some code (that doesn't work)what I am attempting to do:
package
{
import fl.transitions.easing.Regular;
import fl.transitions.Tween;[code]....
I am able to stash the event in a class variable, and then access it later, but the cherry on the icing would be to get it from the event fired withing tweenHandler() in my example above.
Edit: Well,it doesn't look possible.I am currently storing the retrieved event in a property _event and then getting it at a later time when I need it.This seems to work, but isn't wonderful.
View 1 Replies
May 4, 2005
I was certain that this type of problem would have been previously discussed here or in a tutorial. I have looked quite a bit and could not find anything that puts all the pieces of my puzzle together.As the movie is playing (looping), I would like the movie to stop at the current frame whenever I click and hold the mouse down within the area of the container. Furthermore, I would like to be able to scrub the movie backward if I drag my mouse to the left within the container and as I reach the left end of the container, the movie is at the first frame. And similarly, I would like to scrub forward if I drag to the right within the container and as I reach the right end of the container, the movie is at the last frame. On top of this daunting task, I would like the movie to resume playing from wherever I have released the mouse.
Here is a file that I have started and I am pretty much at a loss as to where to go now. I know it has something to do with where the mouse is relative to either side of the container, but...how does one get it to work?Basically, I would like to emulate the functionality of the QuickTime Player - the one where you can grab the slider and drag it left or right to scrub in either direction and then upon release of the slider it resumes playing.I do not understand the media components in MX 2004, maybe this type of thing is "easy" to program in to one of those modules?
View 1 Replies
Jan 21, 2011
I have 3 frames each with a movie clip called map_mc. Each different map_mc have different objects that call the CollisionDetect class. Heres whats happening. objects from frame 1 will start freaking out when I goto frame 2. How do I remove only the event listeners from objects only on frame 1?
I have been trying this.currentFrame but the problem is that all the objects are inside map_mc on the first frame so no matter what it will always be 1. On the other hand MovieClip(root).currentFrame will always give me the current frame but wont tell me what the objects frame is relative to the stage.What I want to do is have something to this effect:MovieClip(root).this.currentFrame would output that this object is on frame 1 and MovieClip(root).currentFrame will tell me that the stage is on frame 2 so I can remove the listeners accordingly.
View 3 Replies
Nov 3, 2009
I have a code in AS3 that works when you rollover it. I need to use the same code but not with an eventlistener for a mouse event but a frame event when the timeline plays the clip
var coordX:Number = shaker_mc.x;var coordY:Number = shaker_mc.y;var timer:Timer = new Timer(10); shaker_mc.buttonMode = false; shaker_mc.addEventListener(MouseEvent.MOUSE_OVER,startShake);shaker_mc.addEventListener(Mous
[code]....
View 4 Replies
Oct 26, 2010
Why won't this ENTER_FRAME event stop firing when I call view_stats_exit before going to view_start? public function view_start [code]
View 1 Replies
May 25, 2011
I have a small flash site made up of a number of pages all on the one timeline.
The query is this. When i release a button i want the timeline to roll on for x frames (fading components out) before going to the frame that button links to (The beginning of the new page).
I have no idea what AS to use for this.
No matter where in the timeline you are, the button should fade out that area and then skip to a new one.
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
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
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
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 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
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
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