Forum Moderators: open

Message Too Old, No Replies

Flash Action Script . Help!

         

xposure

1:46 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Hello, I was asked to fix a couple things in a Flash Movie for a friends client. However, one of the fixes deals with the action script and I just don't know enough about that yet ... so if anyone can help I would appreciate it. Here is the problem ...

The scene has a clock on it ... set to 0:00 when the scene starts. The text states that the test takes two minutes, however, when the clock starts its count it only goes to the 1:00 minute mark. The question was to see how I can alter the below action script to make the counter count to 2 minutes instead of 1 minute.

The script:

onClipEvent (enterFrame) {
myCount = Number(_parent.count);
if (myCount<=9) {
_parent.myTime = String("00:0"+myCount);
} else if (myCount>=60) {
_parent.myTime = String("01:00");
} else {
_parent.myTime = String("00:"+myCount);
}
_parent.count = myCount+2;
}
Thanks for any help ...

-Scott

Richard_N

2:08 pm on Aug 31, 2005 (gmt 0)



simple quick look suggest you change the count from 60 to 120

xposure

2:35 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Hey Richard ... thanks for the response.

I tried that already and it didn't work. I also tried to change the script line ... _parent.myTime = String("01:00"); to _parent.myTime = String("02:00"); ... along with several combinations with no luck.

Any other suggestions?

benihana

2:39 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



are there any other references to count in the movie? maybe on the main timeline?

xposure

2:44 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



There is a frame with the reference "count=2" ... because it is listed as "2" I assumed it had nothing to do with the time count. I will look through the script for more refrences.

Richard_N

5:01 pm on Aug 31, 2005 (gmt 0)



OK

First it references a variable _parent.count and sets the MyCount variable to its value.

It then says if MyCount is less or equal to 9 then the instance of myTime on the parent timeline is set to 00.0 plus the variable myCount (presumably to compensate for loa times.

It then says if MyCount is greater or equal to 60 (one minute) set the instance of myTime to 01.00 in text form.

if however any other value applies set myTime to zero 00.0 as a text string.

It then adds 2 to the variable myCount until the above condition of reaching 60 is met

Theerfore:

onClipEvent (enterFrame) {
myCount = Number(_parent.count);
if (myCount<=9) {
_parent.myTime = String("00:0"+myCount);
} else if (myCount>=120) {
_parent.myTime = String("02:00");
} else {
_parent.myTime = String("00:"+myCount);
}
_parent.count = myCount+2;

Should just change everything to two minutes rather than one... hope that helps.

sokhodom

5:01 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Hello, try to change this:

onClipEvent (enterFrame) {
myCount = Number(_parent.count);
if (myCount<=9) {
_parent.myTime = String("00:0"+myCount);
} else if ((myCount>=60) && (myCount<70)) {
myCount2 = (myCount - 60);
_parent.myTime = String("01:0" + myCount2);
} else if (myCount>=70) {
myCount2 = (myCount - 60);
_parent.myTime = String("01:" + myCount2);
} else if (myCount >=120){
_parent.myTime = String("02:00");
} else {
_parent.myTime = String("00:"+myCount);
}
_parent.count = myCount+2;
}

Hope you get the idea.. (i havent' not tried out using the Flash IDE. but from here you may start to dig it out urself).
Cheers :)

xposure

5:47 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Thanks for the responses ... I tried to plug in the last two suggestions with no success. Is there a way i can upload the .fla file so you can see the code better?

Thanks again.