PDA

View Full Version : variable true at 50%


marco66
03-27-2003, 10:44 AM
hi all,
this is my crazy problem:
I got a variable that must be true one time on two, that is 50%,
every time I load my (same) movie. It must not be a random casuality,
but a right sequence of true or false at any following loading.

help me please!!!

bluegel
03-27-2003, 10:49 AM
can you give a little more info, I don't quite get the question.

thanx

farafiro
03-27-2003, 10:59 AM
wow, what a question
is it related to the Nano second

marco66
03-27-2003, 11:12 AM
Originally posted by bluegel
can you give a little more info, I don't quite get the question.

thanx

suppose my flash name is marco.swf.
Inside I've a movieclip like that:

onClipEvent (load) {

c =0

}

next time I load marco.swf it should be:

onClipEvent (load) {

c =1

}

next time again:

onClipEvent (load) {

c =0

}

and so on...

got the problem??

farafiro
03-27-2003, 11:17 AM
ahuh
ok, u r after the SharedObject, read the tut about it in the tutorials section
sorry about the nano second ;)
was just a joke :D

marco66
03-27-2003, 11:59 AM
sorry, but I did not find any good clue in the tut you suggest.

are you sure it's the right tut?
can you please give me different help?

thx:)

farafiro
03-27-2003, 12:14 PM
why marco it's not what u r after,
ok, u want each time the swf be opened a variable get's added by one
and the SharedObject now is the only way u can know by it that whether a spacified use opened a movie or not

marco66
03-27-2003, 12:21 PM
you're right, farafiro, but I have to pubblish a swf for FLASH PLAYER 5 and not 6.

any other clue? note that I can't use server side technologies...

farafiro
03-27-2003, 12:25 PM
I don't think there is another way

senocular
03-27-2003, 12:53 PM
Make an object in the Object.prototype (though it doesnt have to be there, it could be somewhere like _root) and store your variable for that clip there. ie


// on the main timeline
Object.prototype.varKeeper = {}

// on the movieclip
onClipEvent(load){
if (!varKeeper[this]) varKeeper[this] = {c:false};
else varKeeper[this].c = !varKeeper[this].c;
c = varKeeper[this].c;

trace(c);
}


then each time a new swf is loaded in, the c variable will be true and false alternating. Since 'this' is used as the reference in the varKeeper, it can be used with any movieclip set up this way

marco66
03-27-2003, 01:10 PM
thx senocular for the reply,

just a question:
may I use your script in Flash 5?

farafiro
03-27-2003, 01:14 PM
so seno, this will work if the MC published on the web. opened the closed, reopened??