ActionScript 3.0 :: Call Function After The 'animation'?
Jul 12, 2010
basically i want this function to only be called after the 'animation'. when the hero dies hero.play() is called and this plays the death animation for the hero, i then called gameOver() which brings up a menu, but i only want the gameOver function to be called if the hero.play() animation is completed.
What I'd like to know is that if I could set up a eventlistener to wait until the MovieClip has reached the final frame, then fire a function.
Solution: In the last frame of the MovieClip timeline:Code: Select all dispatchEvent(new Event("EventName")); In the main timeline/class:Code: Select allMovieClip.addEventListener("EventName", FunctionName);
I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.
I have an enterFrame action that I use on a graphic:
[Code]....
Because I want to use the above code more than a few times, I tried to make it a function.
[Code]....
But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.
I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.
Can this be done? I am trying to use the ExternalInterface.call()
have a node that has an asfunction embedded - won't work. if I change the a href to a web page- it works fine. If I try to call a custom function it doesn't call it at all.
im trying to do is have a button that shows an animation (created by a duplicateMovieClip function) with onRollOver and stops the animation with onRollOut. It works when i roll over and it stops when i roll out, but then it continues in a loop up to the point where i rolled out (instead of cutting off completely as i would like). Id be extremely grateful if you could tell me where im going wrong.
I have an AS3 program that calls a function multiple times. The function must return multiple variables, so I created a class for the function to declare an object containing all of these variables. For example, here's my class:
package { public class PER { [Code].....
Let's say the calling program calls the function, which returns the variables into data_set1 (where data_set1 depends on input variables arg1, arg2, arg3) using:
var data_set1:PER = function_name(arg1, arg2, arg3);
The calling program does some stuff, then calls the function again, but returns the variables into a new variable name, data_set2:
var data_set2:PER = function_name(arg4, arg5, arg6);
My intention is that data_set1 and data_set2 are different (e.g. not linked together).
My question is, given that arrays are passed by reference, will data_set1 be modified to agree with data_set2 upon the 2nd function call? Why or why not?
this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.
ActionScript Code: function function1(e:event):void{ //code
[Code]....
Can I somehow, stop the enter frame in function 2 with some code in function3? I know that is not the better practice, but in this case is really needful to have a function inside another.
I have made a simply condition calling a constructor of a class. Today I had to add an "else if", what caused the compilator to show me "A function call on a non-function was attempted."...
Code: function loadIt() { if (var1 == "1") {[code]....
I have this class where I have a dynamic function name, but I don't understand how to call it, I'm getting all kinds or errors, but most the Incompatible Override and Duplicate function definition.Here's the class:
Say I have 20 buttons, each calls a function to draw a square on the screen in a different place. So we'll call those 20 functions square1, square2, etc. Now say I also have 1 more button called all, and if I click that button I want all 20 of the square functions to execute. I've tried the following and I get errors.
function allSquares(e:MouseEvent):void { square1(); square2();