Eating CPU cycles

fspaiva just posted a thread with a scale script

http://www.kirupaforum.com/forums/showthread.php?threadid=24435

attached to a movie is attached this script :

onClipEvent (load) {
easeScale = function (xscale, yscale) {
_xscale += (xscale-_xscale)/7;
_yscale += (yscale-_yscale)/7;
};
}

when i try this script and watch the CPU monitor of the computer, after hitting one button this movie keeps eating cycles and a lot of it, meaning after the movie has adapted to it’s new set scale, so tried if adding an “if” in the script could stop that :

onClipEvent (load) {
easeScale = function (xscale, yscale) {
if (_xscale != xscale) {
_xscale += (xscale-_xscale)/7;
_yscale += (yscale-_yscale)/7;
}
}
}

but that doesn’t work, the CPU keeps peaking, so my question is, should i worry about these things? if so what to edit to make that more efficient?

meisje

i made that script. i think somewhere along the way i put in a line of code that made it more efficient…download the source i put up, it’s in there somewhere. if not, let me know and i’ll re-upload it.

hello thor,

i’m afraid i don’t know where to look, i searched the forums but nopes…

meisje

here’s the link:http://www.kirupaforum.com/forums/showthread.php?s=&threadid=24364&highlight=scale+with+easing

hi thor, took me a while before i got it but it works as advertised, no more CPU peaks.

thanks again :slight_smile: meisje

thor/meisje

would be so kind as to clue me in on what you did because to me the code looks pretty standard???

I’m sure I’m missing something

I was going to try a countdown to delete the movie myself but if there’s something easier or better then I’d like to learn

hi meridian

“I was going to try a countdown to delete the movie myself but if there’s something easier or better then I’d like to learn”

i am not sure what you are asking… deleting a movie? countdown? this doesn’t seem to have any realtion to the discussed topic

could you re-phrase please? :slight_smile: meisje

Sorry about that :slight_smile:

I was refering to what I thought was the onEnterframe continuously looping causing the cpu usage running, but on futher investigation it is the drag function for the hover captions and the actual drag of the mc that’s causing the high cpu usage.

ok :slight_smile:

Anyone got any pointers on making the drag function not cause so much cpu usage?

i haven’t seen your code but unless your CPU keeps peaking after the drag action you can’t help the CPU from peaking, it’s a videocard issue too, draging normal operating systemwindows (meaning outside of flash) is a rather intensive task, so unless the CPU keeps peaking i wouldn’t worry about it

No it’s only during the actual drag.

Would setting the alpha = 50 intesify that too?

yes, setting an alpha will intensify usage, prettiness comes with a cpu-pricetag :slight_smile:

Heh, ok :slight_smile: thanks for the input I’ve been having such a good time learning all this action script stuff from the tutorials and all the great input you guys have been giving me :slight_smile:

same here :slight_smile:

later meridian, meisje