DPZero's way will work but it gets you back to a timeline issue thats a lot harder to control in the long run.
To answer your question you can use if/else to check conditions as well as "and" and "or" within the conditions.
typical if/else in AS2 (I don't know how it works in AS3 since I haven't had time to learn the new hotness)
if(myVariable == "someString"){
// perform this code
}else{
// perform this other code
}
// conditions:
// <= less than or equal to
// >= greater than or equal to
// == exactly equal to
// != not equal to
// < less than
// > greater than
- if(myVariable == "someString"){
- // perform this code
- }else{
- // perform this other code
- }
- // conditions:
- // <= less than or equal to
- // >= greater than or equal to
- // == exactly equal to
- // != not equal to
- // < less than
- // > greater than
you can also do multiple conditions inside an if statement using "AND" ( && ) and "OR" ( || )
if(myVar1 == 2 && myVar2 < 30){
// perform actions when myVar1 is equal to 2 and myVar2 is less than 30
}else{
// condition isn't met do this....
}
- if(myVar1 == 2 && myVar2 < 30){
- // perform actions when myVar1 is equal to 2 and myVar2 is less than 30
- }else{
- // condition isn't met do this....
- }
You might also want to look up how to use case statements in flash. These are a better way to deal with a long list of conditions (like which button was called)
I think I would build a function that modifies a range of image numbers
function moveForward(startFrame, endFrame){
// generic code to transform images that you can reuse
}
- function moveForward(startFrame, endFrame){
- // generic code to transform images that you can reuse
- }
Here's an example of something I was just working on using the swap depths to fake animation. Wait for all the images to load and mouse over the "spin me" text
PS: you should do your animations in Flash, not import them frame by frame
Typically I agree, especially if your animation can be vector. However, there are some things that Flash just can't do when it comes to animation. Good 3D with reflections, motion frame blending, motion tracking, etc just aren't possible with Flash's animation engine and you need to find an alternative.
@BenBob: You might actually want to consider using video for your animations. It will pose its own set of difficulties, but its going to be easier to load/que etc and it might be less processor intensive at run time depending on how large you need the images to be.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com