ActionScript 3.0 :: Have One Function Happen After Another?
Feb 7, 2009i have function 1 and function 2 out there what I want to happen is first to run function 1, check if it's completed and then run function 2
View 4 Repliesi have function 1 and function 2 out there what I want to happen is first to run function 1, check if it's completed and then run function 2
View 4 RepliesI'm trying to make this script work in which two things should happen onRlease of a movie clip. In the script below, the "transition" plays but frame 18 doesn't..even though the path is right. I even tried frame label even that doesn't work. The script is on the clip itself.
_root.navbtns_mc.webnav.onRelease = function() {
_root.transMC.gotoAndPlay("transition");
_root.navbtns_mc.webnav.gotoAndStop(18);
}
I am trying to create a public function, i have a decument class with all of my variables in it, I have worked out how to bring in external .swf files, now I need a way to have an even trigger something on a separate .swf So at the moment I have a flunction that works on the parent
stage.addEventListener(MouseEvent.MOUSE_MOVE, mousePosition);
function mousePosition(event:MouseEvent) {
if(mouseX>=125)
[Code]....
How can I delay this function to happen 5 seconds AFTER I rolled my mouse over:
[AS]
on (rollOver) {
_root.mc_fotos.onEnterFrame = function() {
this._x -= ((this._x + 2800) / 4);
[Code].....
I am working with Flex 4 windowed application. I have a mx:HTML container with location attribute like [URL]. That abc.html has a html button and i want when that html button is clicked then a flex windowed application function should be called.
Dummy Flex 4 windowed application screen shot: [URL]
I am trying to make a movie clip fade in after several movie clips are pressed. It does not matter what order they are clicked in-Just as all of them are pressed. Does anyone know what this is called so i can find a solution?
View 3 RepliesI want to change the text of a dynamic text box based on the frame number. Something like this:
Code:
if (_currentframe > 222 && _currentframe < 2222) {
txtMessage.text = "Pump turned on";
}else{[code]......
But this doesn't work.
I need to have 4 buttons that play 4 different MCs. I want a 5th MC to play after all 4 MCs have been played.
View 1 RepliesI currently have a large picture on screen which I intend to show 1/3 at a time. Each time you click a button the picture tweens up 1/3. Basically what I want to happen is, on the 4th click, once the picture has been seen in its entirety I want it to vanish. The only piece of code I need is, how to make a new event happen on the 4th click.
View 6 RepliesSay you have a document class, and a customMenu class. If they import some of the same classes, would it be less overhead if everything was in the document class? Thus imports only happen one time?
View 3 RepliesI have some AS3 code that does two things. Only I want the 2 things to happen 10 seconds apart. The lines of code look like:
var myTween:Tween = new Tween(yellow, "x", Bounce.easeOut, startValue, finishValue, duration, true);
var myTweenBlue:Tween = new Tween(blue, "x", Bounce.easeOut, startValue, finishValue, duration, true);
Right now, they happen at the same time, but I would like them to happen a few seconds apart. I have seen where I can pause the timeline, but in this case, the timeline is already stopped. these actions are triggered by clicking on a button. So Im not sure how to make it so the two actions happen a few seconds apart.
I'm making an Elder Scrolls type game and I want my enemies to hurt me after a certain time.So pretend like 5 seconds after they come on the stage they would take 5 hp off me.Then when one of the enemies die it stops until another enemy comes on the stage then it counts how long its been on the stage.This is what I have so far:
Actionscript Code:
var tmr1:Timer=new Timer(2800); var tmr2:Timer=new Timer(5000);
[code]...
I have a picture that is 500x500. My stage is 500x500. I have a tool bar that is on the bottom of the screen. It is in front of the picture. My onRollOver command is set so that on roll over the picture changes. Even if I am hovering over the toolbar the image still changes. I can not for the life of me figure out how to not have the onRollOver happen when the cursor is over the toolbar. Picture = pic_mc and toolbar = tb_mc I can not figure this out and I know how simple this is, but I am just at a lose. SIDENOTE: The tool bar is not a rectangle it is an irregular shape so I can't just say X,y area I figured I could use the toolbar shape to be the "block" from the image activating the onRollOver.
View 12 RepliesIf I put an if else statement in a for loop it will stop the loop till the if else statement has completed. I'm trying to run something else during my for loop. How do I do that??Here's my for loop:
ActionScript Code:
for (var i:int = 0; i < testArray.length; i++) {
chickletMc = new chicklet();
[code]........
I have greated an animation which, I want to appear only when the mouse has been inactive for a certain period of time.
View 1 Replieshow to get something to happen according to the mouse's proximity to an object? like say i have a square & i want that square to get bigger the closer the mouse gets to it... how would one do that?
View 1 Repliesi am creating a flash website, i have a preloader at the start of the site. My problem is that when i view it as it would be seen on a browser the preloader doesn't appear straight away. i have an image with the preloader (site logo) and is 182kb file size and am guessing that this picture needs to load first for the next action to happen. if htis is so, other then reducing the file size is there anyway to make the preloader appear straight away.
View 1 RepliesURL...The preloader on this site seems to run through a complete animation before moving forward in the movie.I am curious if there is something to how preloaders like this work. Does each animation happen after a certain precent is loaded (in this example, when the squares turn green) or are they just animations that have nothing to do with the actual preloading?
View 1 RepliesI've been trying to use random to make something happen a certain percentage of the time. For example, for making the scientist go to frame 91 half the time and 181 the other half, I was using this code:
[Code]...
I am trying to create a timed event which will happen every 10ms. I want to achieve a high level of precision (+- 1ms) but I have not found any way to do this. I tried to use the frame rate, but that varied a lot. I also tried to use the timer class, but this did not work very well either (even when I set the timer to go off every millisecond, it went off anywhere between 3 to 40 ms.) Even after using the timer class with getTimer(); I had no guarantee that the event would happen every 10ms.
Code:
import flash.utils.*;
var LastTime:Number = getTimer();
var myTimer:Timer = new Timer(1);
myTimer.addEventListener(TimerEvent.TIMER, TimeCheck);
myTimer.start();
[Code] .....
I am designing a physics container. Don't worry, my question is not about the physics. Here is part of my code. Noticed that I have a SetStyle statement there. I realized that if I don't have that line, the MOUSE_DOWN, MOUSE_UP events won't work. If I do have that line, then those events works fine.
Code:
package components {
import flash.events.MouseEvent;
import spark.components.SkinnableContainer;
public class Test extends SkinnableContainer {
private var mouseDown:Boolean;
[Code] .....
in actionscript, Is there a way i can make a coddition happen if 2 keys at once are pressed?
example:
if (Key.isDown(Key.SHIFT) && (Key.isDown(Key.LEFT) && _currentframe == 1)) {
gotoAndPlay("running_left");
} else if (Key.isDown(Key.RIGHT) && (Key.isDown(Key.RIGHT) && _currentframe == 1)) {
gotoAndPlay("running_right");
}
or can't i do shift and left/right?
download the .fla (file updated for flash8) file, run it and you'll see the problem.
when i do this:
PHP Code:
_root.image._width=200;_root.image._height=200;
ist seems that the motion tweens don't work any more.
[URL] If you look at the file above, you'll see a bunch of boxes. If you hover over the right edge of a box, it will glow green, if you then click and drag from that edge, what should happen is a blue line should extend from the box to the mouse. However, it doesn't. Furthermore, the endpoint of the blue line (which should be the mouse) is somehow related to the numbered box on the right in the middle. If you drag that box around, you'll see the behavior I mentioned above change. Here's the bit of code that draws that line:
[Code]...
Is it possible to make tweens happen at the same time with Greensock Timelinelite?
I know it could be possible to fake it by putting a negative delay in but that's not very accurate.
I have a set of images of dogs and a doghouse.
1. Each dog has an email assigned to it for the person.
2. Clicking on a dog (or alternatively "dragging it"), puts it in the doghouse and moves the existing dog out to the now empty location.
3. Once moved in, ther should be a button presented to create an email to the person saying they have been placed in the doghouse (so..like..mailto??).
4. Maybe an image of the doghouse with them in it could attached to the email.
5. LATER: The state of the page could be kept so future visitors know that the person is in the Doghouse.
I have an old JavaScript page that kind of shows the functions:
FAMILY DOGHOUSE
Also, what I have done in FLASH (so far) is also shown at the bottom of the page.
1. Not sure how to make the action wait for the mouse click or drag!
2. Also, maybe a button, once the people decide who goes in the doghouse, to submit and fire the email??
When I chose this little project I thought it was easy, but I realize I have not a clue how to begin beyond making buttons and tweens.
I'm trying to create a particular effect using the Kirupa tutorial for Flash Snow 3.0.The size of the stage I'm working with is 800x600, but I need the animation to only happen in the center of the stage, in an area approximately 400x400. I've tried masking to no effect I'm sure it's something that I just need to enter in the script,
View 1 RepliesHow do you capture errors that happen on client side when building RIA apps using Flex and Silverlight? What are the common practices? I have seen some asynch js calls to a web service implemented but would like to know how the community is dealing with it.
View 5 RepliesI'm having a huge problem with my Flash file; here is what I'm trying to do and whats happening:
I have a scene where with a movie clip that is controlled by the keyboard, when it hit a certain point of the stage it opens a new scene where a certain animation should happen.
The problem is every time the animation hits that certain point the code I was using continues running and flash shows me an error message.
Error message:
How can I make this code work only on the scene its placed so I won't get this ERROR?
Here is the code I'm using:
I have developed a simple chat room but how do I go about showing who is online and what happen if the user close the web browser without disconnect, will the user name in the online list be remove immediately? I use mx.messaging.channels.StreamingAMFChannel and set <subscription-timeout-minutes>3</subscription-timeout-minutes>
View 1 Replies