PDA

View Full Version : Memory leak?


jrutis
06-05-2002, 02:29 PM
I have a function that sets correct position, changes colors and plays a sound when a button is dragged and dropped. It works great in test mode but when I try to use it by double-clicking the .swf file or in a .html it doesn't work at all.

If I put in traces it works partially.

If I was working in C I'd think it was a memory leak.

What should I look for?

John

Ricod
06-05-2002, 03:19 PM
I never heard of memory leakage with actionscript :)

It's probably sumthing silly. R u perhaps loading in data or sumthing ? Its hard to tell from here u know.

If u trace the used data, where does it go wrong ?

jrutis
06-05-2002, 05:14 PM
Thanks for the reply!

I didn't think it was really a memory leak. It's just that when you have on in C it acts something like this is acting.

Traces don't help me when I'm not in test mode and it works fine in test mode. It drops in the right spot changes color and makes the sound.

When I try to run it for reals it won't even drag and drop. If I put traces in, even though I can't see the results, it drags and drops but in the wrong place and doesn't change color or make the sound.

I could put up the function but I thought maybe the symptoms were familiar to someone and it was just something dumb I'm doing.

John

tg
06-05-2002, 06:14 PM
add this to one of your frames:

// simple alert / userful to show vars outside of flash / debugging /
Movieclip.prototype.alert = function(s){
getURL('javascript:alert("'+s+'")');
}


then replace your trace() actions with

//on _root, or from inside a mc
this.alert("put message in here");
//or
this.alert(myVar2Trace);


you will get a messagebox popup with the var/message.

pixelwit
06-06-2002, 05:38 AM
That's pretty sweet TG.

Now I know how to trace a message in the browser window using Javascript. I think that may be handy at some point in time.

Thanks,

-PiXELWiT
http://www.pixelwit.com

Ricod
06-06-2002, 11:45 AM
Or, if you're not using html / java u could put an extra layer on top of the rest of your swf, put a dynamic textbox in and send the variables there.

jrutis
06-06-2002, 02:08 PM
Thanks for the help!

I'll try it as soon as I can - but...

I created the most simplified version I could and the "on (release)" will only do the "stopdrag" and nothing else. If I comment out the stopdrag it does nothing (that is - it doesn't stop dragging). This is only in the normal execution modes; in the test mode it does everything it's supposed to. I've even duplicated the function's innards as just lines within the "on (release)".

I find this bizarre since I have other applications where I do the same kinds of things and they work just great in both test and execution modes.

John

Ricod
06-07-2002, 09:58 AM
Why don't u copy paste the code here ? (use code brackets around them plz ... and disable smilies)

Maybe its umthing silly which you've missed cuz you've been staring at the same piece of code for a day or so (I know I usually miss stuff after being toasted)

jrutis
06-07-2002, 03:05 PM
Hi!

The little "alert" function works in test mode but not in normal or html mode.

I just discovered it works fine on Explorer.

Here are the facts:

It works correctly in test mode (CTRL-S).

It doesn't work in normal Flash player mode.

It doesn't work in html in Navigator.

It works correctly in html in Explorer.

When I say it doesn't work I mean stopdrag always works but no other action I've tried ever works.

This is true whether I put the actions in a function and call it or if I put the actions directly in the "on(release)".

Here's my simple attempt:

on(release, releaseOutside) {
stopdrag();
C = new Color("/Testbox");
C.setRGB(0xFF0000);
setProperty("/Testbox", _x, 100);
setProperty("/Testbox", _y, 100);
}

The Testbox is blue to start and at 200,200.

It doesn't move to 100, 100 or change color in normal or Navigator. It does in test or Explorer.

As I said, I've done other applications with very similar function and have had no trouble.

Thanks again!

John

tg
06-07-2002, 03:17 PM
hmm... the alert box works for me all the time in ie4.x+, netscape 4.x+, opera.
i use it all the time.

won't work in a projector file tho... uses javascript.

tg
06-07-2002, 03:23 PM
make sure you have the same player version for both netscape and ie. your flash code should work the same in both.
also, try making all your code the same version/style. you are using both f5 and f4 syntax.
try:

on(release, releaseOutside) {
//what are you dragging? testbox?
//_root.Testbox.stopDrag();
//or something else?... 'this' would be whatever the button is on.
this.stopDrag();
C = new Color("/Testbox");
C.setRGB(0xFF0000);
//setProperty("/Testbox", _x, 100);
_root.Testbox._x=100;
//setProperty("/Testbox", _y, 100);
_root.Testbox._y=100;
}

jrutis
06-11-2002, 03:05 PM
Hi!

Thank you for all your help; I've learned a lot!

The problem is fixed!

I found that I had two Netscapes on two drives - one had the Flash 5.0 plugin and the other had the Flosh 4.0 plugin.

When I'd double-click the Flash-generated HTML file it would use the one with the Flash 4.0 plugin. (It didn't do that before - I don't know why it changed.

When I'd drag the Flash-generated HTML file to the desktop Netscape alias it accessed the one with the Flash 5.0 plugin.

What then was causing the Flash player to fail?

So I dragged the .swf file into the flash player that came with Flash 5 - it worked!

I went looking for other Flash players and found one I didn't even know I had - it came with Freehand 9 and was version 4. When I got rid of that, everything works GREAT.

Thank you for all your help! I'm thankful there are experts willing to take their time to help!!!

John