ActionScript 3.0 :: Frame Move On If Statement?
Jul 22, 2009why this MC always jumps to frame 76...here is my code
function goQuestion(e:Event){
if(e.currentTarget.frame <=(60)){
e.currentTarget.gotoAndPlay(60)
[code]....
why this MC always jumps to frame 76...here is my code
function goQuestion(e:Event){
if(e.currentTarget.frame <=(60)){
e.currentTarget.gotoAndPlay(60)
[code]....
This is an if stament on a frame on the root. I want to loop Carrera(a lenghthy movieclip) from frame 2 back to frame 1. (For testing purposes) This is the code:
[Code]...
I am trying to use this if statement with a frame label instead of a frame number. I believe that _currentframe is looking for a number only. Is there a different command that looks at frame labels instead of frame numbers?
View 1 RepliesI am trying to use this if statement with a frame label instead of a frame number. I believe that _currentframe is looking for a number only. Is there a different command that looks at frame labels instead of frame numbers?
View 1 RepliesHow can I stop the event listener and move into my second if statement I just can't get it to work
Code:
var step:int = 1;
if (step == 1)
{
[Code]....
I'm still struggling with going from a loaded swf to the next frame in my timeline, where a new swf file will be loaded.Ths is my current code which is trying to move onto the next frame in my timeline is located at the end Frame of a 10 second animation:
[Code]...
How would you use an if statement to say if you're on a certain frame do this.
if(frame is # 2){
something = true
}
if(frame is # 1){
something = false
}
I'm having difficulty searching it since keyword frame brings up everything. I'm looking to reference the frame number in an if statement.
A small note I'm doing this cause the listeners I'm using to target key presses are interfering with each other when, even when the actionscript is on different frames.
I'm trying to use an if statement on a frame, but it doesn't seem to work do i need to put into some sort of function?
View 2 RepliesI have a flash file that consists of a number of loops that play in series that allows me to change the duration of each part of the movie dependent on what is in the loop. Therefore loop 1 plays x number of times before moving on the loop 2 that plays y number of times and so on. I had worked out all my timings so that each loop last half a second. The number of times each loop plays is controlled by an if statement on the last frame of each loop. So far so good. In this main movie have another movie clip that runs independently of these loops and I noticed that although it was the same length as the main movie taking the loops into account, it would drift out of sync as the main movie progressed and looked as if it was running slow. However by tracing frame numbers of the two movies, I noticed that each time the main movie reaches on of the if statement frames although it appears to increment by one frame the other movie doesn't. By commenting out all the if statement frames both movie run in sync.
Therefore I conclude that a frame that controls the playhead position in this method does not actually last a full frame in duration, but jumps immediately to the new frame as soon as the command is encountered. Can I assume that this is constant and that frames used to move the playhead occupy no time in terms of the main timeline? Is there any documentation on this?
If I have a movie clip with named frames, can I reference the frame names in an if-else statement? For instance,
if (frame name = "frame1")
gotoAndStop.frame2;
etc. Is that doable?
I need help with the 'If' statement I want it so when i click a button till the socre gets to 5 I want it to go to another frame.
View 8 RepliesI have a animation in my loader_mc that I want to start at one frame and play to it then stop then when you click on it again I want it to play from a certain point. But what is happening is that it will initially do everything it is supposed to but than mess up after the initial 2 clicks. Check out the onRelease event and you will see what I am currently trying to do. [URL]
View 2 RepliesI'm currently working on a puzzle. The objective of the puzzle is to place the numbers in order from 1 - 10. Once the puzzle is complete you're taken to a specific frame.However, I want to be able to go to 1 of 2 frames depending on how long it takes to complete the puzzle.Each number has the following code:
on (press) {
startDrag(this, true);
}
on (release) {[code]....
I am using Koolmoves to create a simple .swf file that allows a user to click on a picture and it moves to the next frame and stops. I created the two frames, created a button on the picture in the first frame, designated that on mouse events press and release go to frame 2 and stop. But when I play the movie, the first frame appears and then the second frame appears without any action on my part.
View 7 RepliesI'm testing flash and decided to make an asteroids clone. It works well but all the code is loaded in the first, and only, frame.Now I want to add a preloader but I cant find the way to move the code to the second frame. I don't want to create a swf and embed it. Also there are no assets created in flash, it has been coded exclusively in flashdevelop (I find it easier to use).
View 4 RepliesThe following code is 4 loading an external movie or image which i wrote in first frame of falsh movie the following code is working fine:
[AS]
var flag = false;
var percent = 0;
[Code]...
Having a few problems with what I thought was a simple if statement. Here is the code:
[Code]...
I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.
if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code
[Code]...
I dont want to copy the code from the first into the second and the first and second into the third.
My mind isn't working and there is probably an extremelly simple way to get this working.
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);
Heres the code:
Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
[code]....
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.
How do you press a key (like "L") and go to the next frame?
Which event must I pick?
I assume it's something like: stage.addEventListener(Keyboard., but after that I don't know what to do.
This is for AS 3.0 by the way.
Can you tell me what the quickest code is to go from frame 4 to frame 5 with a 6 second pause on frame 4?, I can't figure it out and I have a deadline today! Heres the current code on frame 4... this isn't working, not familiar with
[Code]...
But the plan is to make a "Drag and drop" Object that we are supposed to move around til the finish line.The problem is basically that I can't seem to find any decent ways of making this happen..When this "object" hits the other "object" (finish line) we move to the next frame.should be a simple/short line of code I think, from own experience.I have on my own exploring found similar problems without beeing able to fix it for my purpose:"One Object Hits Another It Goes To Another Frame."
View 1 RepliesI need to create a button inside MC1 that will send me to the frame2 of the main timeline, but to and to a specific frame in MC2, which only exists there, as I said.
If that is not possible, is there a way to create this button in the main timeline?
I have a maze with a mc controlled by using the keyboard arrows. I have also created another mc at the end of the maze so that when the original mc controlled by the user reaches the end it moves to the next frame.
View 4 RepliesSo at first I have 1 frame and everything was in it. Then I decided I want something to go before this, So I select all layers and pull everything to the second frame. But then I start getting the 1009 error, something about null object.
View 3 RepliesSo in my Main Timeline I have 2 Layers each with a movieclip attached, named Intro on the first frame and on the following frame Menu.
The problem is that my Intro Movieclip does not finish playing it's animation until the Menu frame pops up.
Within the Intro I have a animation and a Actions layer with:
stop();
In the end of it.
What I want is that my Intro frame would finish playing it's attached MC and then move the second frame labeled "Menu".
TLR:
How do I move to a label in the main timeline after a MovieClip has finished playing?
MovieClip(parent).gotoAndPlay("menu");
let's say I have one layer, and in the first frame i have movieclip1, and in the second frame i have movieclip2, i've been trying to figure out how to keep it on the first frame until it finishes the movieclip1 and then move on to frame two with the movieclip2 in it. would anyone know?
View 3 Repliesmy it does not stop to frame 2, after the onMotionFinished function is executed. I dont see the green rectangle containing number 2.
View 3 RepliesI have a movieclip and I want that when the movieclip is finished, when it reached the final frame, I want to jump at the next frame on the stage. So I wrote on the stage in the frame that the movieclip is :
Code:
if(intro.currentFrame == 89) {
nextFrame();
}
I also tried in the movieclip something similar, in the last frame I wrote
root.nextFrame();
but nothing works.