|
-
[HELP] Loops - other then For Loops
Hello everyone,
I just have a quick question. Is it possible to use a loop OTHER then the for loop?
This is what I want to accomplish. I have a dynamic text box, and a button. When you hold down the button the dynamic text box increases by 1 (number starting at 1940)
I want it to keep going until you release the button and thought to do so with a loop
If someone could please tell me how to go about doing this, it would be greatly appreciated
Thanks
-
Getting There!
This would be my approach
use enter frame to add the number to your initial value. The button will set a holder clip to a frame that contains an empty clip with the onEnterFrame actions, release will set the holder clip back to the first frame, which doesn't have the empty clip, thus not taxing the processor unneccesarily. Check the attachment.
Last edited by bitsk308; 01-10-2008 at 01:32 PM.
-
bitsk308
Sorry but Im working in Flash MX, and so cannot open your attachment though I appreciate the effort you made
If you could perhaps explain to me what you did in the .fla?
-
Getting There!
Here's an MX and MX04 version (though some things may have been lost in the down conversion, I can't test 'cause I don't have MX.)
Here's the basic Idea:
1. Define a _root variable for your text field, say yourNumber:Number = 1940.
2. Make an empty movie clip and give at instance name of "control_mc"
3. On the first frame of control_mc but a stop() call.
4. On frame 2 of control_mc, add another blank mc, called node_mc.
5. Give node_mc (which should only exist on frame 2) the following code;
onClipEvent(enterFrame){
if(_root.yourNumber < " your max number"){
_root.yourNumber += 1;
}
}
6. Make a button with the following code:
on(press){
_root.control.gotoAndStop(2);
}
on(release){
_root.control.gotoAndStop(1);
}
This should get 'er done.
Last edited by bitsk308; 01-10-2008 at 01:32 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|