all groups > flash actionscript > may 2005 >
You're in the

flash actionscript

group:

Toglle paly and Pause button



Toglle paly and Pause button Haahoou
5/2/2005 12:00:00 AM
flash actionscript: i have a main timeline which is calling swf's.
each swf have mc''s(mc do not have further nested mcs or call any ther swf)
playing in order automatically.
my mc is using a code that made my movie stop for a prticular time.say 3 sec
or 4 sec ......
MovieClip.prototype.pause = function(t) // on the very first
frame of the each swf
{
if (t == 0)
{
t = 3;
}
if (!var314159)
{
var314159 = 0;
playA = new Array();
}
this.stop();
playA[var314159] = setInterval(playF, 1000*t, this, var314159);
var314159++;
};

function playF(mc, ind)
{
mc.play();
clearInterval(playA[ind])
};

Now i want a toggle button that when it is pressed the movie stops no matter
where it is and when pressed again movie starts playing from where it stoped.
regardless that the stop time has finished. (if user preesed the buton at point
where i have above code)

I tried it like this on the mailn timeline, placed a mc which has two buttons
stop ( on frmae 1)
play (on frmae 2)

play buttton has following code
on (press)
{
gotoAndPlay(1);
play();
}

and stop btn has
on (press)
{
gotoAndPlay(2);
stop();
}

but it keeps on shifting between paly and stop btn (means to say that
alternating), but my movie runs smoothly as it should be.


Re: Toglle paly and Pause button kglad
5/2/2005 12:00:00 AM
MovieClip.prototype.pause = function(t) {
if (t == 0){
t = 3;
}
this.stop();
this.intervalVar = setInterval(playF, 1000*t, this);
};

function playF(mc){
mc.play();
clearInterval(mc.intervalVar)
};

attached to your toggle button:

on(press){
if(!evenPress){
evenPress=1;
clearInterval(mc.intervalVar);
mc.stop();
} else {
evenPress=0;
mc.play();
}
}

Re: Toglle paly and Pause button Haahoou
5/9/2005 12:00:00 AM
I tried it but does not work. i even tried it some ohter way as well but that
didnt work too.
i am attaching a file so that its easy for u track the problem.
kindly tell me the mistake that i was making
www.paradigmhouse.com/btn_problem.zip
Re: Toglle paly and Pause button kglad
5/9/2005 12:00:00 AM
Re: Toglle paly and Pause button Haahoou
5/11/2005 3:40:18 AM
sorry I should have mentioned it in the last post.
Main is calling the emp_login,emp_assign_charge, emp_week_selected (in order
they are called) using loadMovieNum
shared.fla is the shared library
control_btn.fla have the toggle btn and its related code.
emp_login,emp_assign_charge, emp_week_selected hte very first frame of the
first layer of the each of these files have the function(that stops the movie
for a specified time) u provide me .
Re: Toglle paly and Pause button kglad
5/15/2005 12:00:00 AM
here are your edited files. i believe this is working the way you want.

Re: Toglle paly and Pause button Haahoou
5/20/2005 12:00:00 AM
First thanks for ur srvices.
I was trying to this same control_btn for another set of files based on the
same pattern, but it is not working there. I have found this script
mcA = ["el", "ets", "instance2", "et"];
and cannot find referance to these. I am confused about it.......
Kindly tell me what is the mistake that i am making.......
the file i am currently working on is this
www.paradigmhouse.com/demo_admin.zip
playing sequence
mainmovie_admin ->summary->admin_add...add3 -> admin_at.....at7 ->
admin_at_search -> admin_at_search1 -> admin_ts.
Re: Toglle paly and Pause button (answer me too late ......) Haahoou
5/24/2005 12:00:00 AM
kindly answer me its too late.
Actually I want to understand how can i use the same btns to use in my other
set of files based on the same pattern.So that i can do it myself i tried it
but can't get the desired result
coz the one mr. Kglad gave me is still working fine(for the previous set of
files) but when i try to use it at other place it do not work(it doesnt give
any error)
in last post i have uploaded the new set of files if u want to view it.(I did
not change the btn file it is same as Mr. Kglad sent me)

Re: Toglle paly and Pause button (answer me toooooooo late ......) kglad
5/26/2005 12:00:00 AM
i don't know how to help you without doing all the work for you. and i don't want to do all that work.

Re: Toglle paly and Pause button (answer me toooooooo late ......) Haahoou
5/27/2005 12:00:00 AM
u r right ........................
mcA = ["el", "ets", "instance2", "et"];
what r these el, ets, etc
I think these hold the clue for my problem.............................
I tried to find it out but cant find referance to these names...........
I'll appriciate ur help
Re: Toglle paly and Pause button (answer me toooooooo late ......) kglad
5/27/2005 12:00:00 AM
Re: Toglle paly and Pause button (answer me toooooooo late ......) kglad
5/27/2005 12:00:00 AM
Re: Toglle paly and Pause button (answer me toooooooo late ......) Haahoou
5/27/2005 12:00:00 AM
thank you very for your patience and time u gave to answer my question.
My problem is solved.
Re: Toglle paly and Pause button (answer me toooooooo late ......) kglad
5/27/2005 12:00:00 AM
Re: Toglle paly and Pause button (answer me toooooooo late ......) Haahoou
7/18/2005 12:00:00 AM
(Specially to Mr. Kglad who answer this post)

I just want to know that what this "level1" means in the code ??
on (press) {
gotoAndStop(2);
for (var i = 0; i<mcA.length; i++) {
clearInterval(_level1[mcA].intervalVar);
_level1[mcA].stop();
}
}

to my knowledge it refers to the level on which the MC is playing.




Re: Toglle paly and Pause button (answer me toooooooo late ......) kglad
7/18/2005 12:00:00 AM
that's correct, _level1 refers to a _level above the main movie (which is
always at _level0).

_level1[mcA[ i ]]

is a reference to an object that's stored as a string value in the array mcA
which is in _level1.
AddThis Social Bookmark Button