[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] FWD: [[Flashcoders] Question About MovieClips in Moock's AS
From: |
strk |
Subject: |
[Gnash-dev] FWD: [[Flashcoders] Question About MovieClips in Moock's AS Definitive Guide] |
Date: |
Thu, 5 Apr 2007 17:14:17 +0200 |
I tought this would be interesting as a validation of current Gnsah
implementation
storing Sprite as_values by their targetPath value.
The flashcoders archive is not public so here it is..
BTW: I highly suggest free flash coders subscribe there, many good info can be
gathered.
--strk;
----- Forwarded message from ChrisRM <address@hidden> -----
Date: Tue, 13 Mar 2007 14:03:33 -0400 (EDT)
From: "ChrisRM" <address@hidden>
Subject: [Flashcoders] Question About MovieClips in Moock's AS Definitive
Guide
Reply-To: address@hidden
To: address@hidden
X-BeenThere: address@hidden
Hi all,
In his book he states:
"References to objects are pointers; reference-tracking and
garbage-collection protect the user from dangling pointers and memory
leakage. References to movie clips, however, are soft references -- the
reference actually contains an absolute target path. If you have a movie
clip named foo, and the set x = foo (which makes x a reference to clip
foo), and then delete foo using removeMovieClip(), and then create another
clip named foo, the reference x will again be valid (it will point to the
new foo clip)."
My example is slightly different and the reference is not being
reestablished.
I have a class that takes a movie clip as a parameter. (var myClassObject
= new myClass(this);) In this movie clip from frames 1 to 5 I have the
movie clip instance clip1. And on frames 6 to 10 I have other assets.
(clip1 does not reside on frames 6 to 10) The main movie clip can toggle
back and forth between these sets of frames.
Inside the myClass constructor it assigns clip1 to other classes.
function myClass(mc:MovieClip) {
mc_clip1 = new subClass(mc.clip1);
}
Now, if the playhead moves to frames 6 to 10 and then back to frames 1 to
5, why is the reference to clip1 in mc_clip1 undefined if they are as
identified in the writing as "soft" references? Shouldn't this reference
be restored?
Possible memory-leak issue:
At the moment, each time frame 1 is reached I call mc_clip1 = new
subClass(mc.clip1) elsewhere within myClass.
Should I perform cleanup before re-instantiating these classes, say if
there is an array, to delete the array - or if there's a reference to an
outside class, to delete that as well?
I know I could do something like this below but was wondering about any
possible memory issues by calling new subClass() over and over on the same
variable.
if (mc_clip1 == undefined) {
mc_clip1 = new subClass(mc.clip1);
} else {
mc_clip1.setMovieClip(mc.clip1);
}
Thanks.
Chris
_______________________________________________
address@hidden
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
----- End forwarded message -----
--
() ASCII Ribbon Campaign
/\ Keep it simple!
- [Gnash-dev] FWD: [[Flashcoders] Question About MovieClips in Moock's AS Definitive Guide],
strk <=