bugGnash - The GNU Flash player - Bugs: bug #27050, SWF6: unloadMovie unimplemented

 
 

bug #27050: SWF6: unloadMovie unimplemented

Submitted by:  Sandro Santilli <strk>
Submitted on:  Fri Jul 17 20:04:12 2009  
 
Category: ActionScriptSeverity: 3 - Normal
Release: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon Aug 24 15:39:45 2009, comment #6:

Another difference I spotted is about onEnterFrame calls.
When removeMovieClip is used, no onEnterFrame is invoked.
When unloadMovie is used, the first onEnterFrame is used.

See this:

createEmptyMovieClip('a', 1);
a.onEnterFrame = function() {
trace(this+' enter frame');
};
a.createEmptyMovieClip('b', 2);
a.b.onEnterFrame = function() {
trace(this+' enter frame');
};
a.b.onUnload = function() {
trace(this+' unload');
};

//a.removeMovieClip();
a.unloadMovie();

Sandro Santilli <strk>
Project Member
Fri Jul 24 10:56:05 2009, comment #5:

Another thing to keep in mind is that unloadMovie'ed clips
must NOT be removed from DisplayList on ::removeUnloaded.

I think we'll need to extend the _unloaded flag to support
multiple states:

0: normal/loaded/??
1: unloaded (not to be destroyed automatically on next frame)
2: removed (to be destroyed automatically on next frame)
3: destroyed

'unloaded' is a state as onUnload is not called again
if you unloadMovie a clip twice. Still, you can scribble
on an unloaded (unloadMovie) character with no problems
and it's still accessible by name at same depth.

You can definitely find unloaded (state 1) movies in the non-removed zone, so DisplayList::display (and very likely
other places) need to be updated to expect that.

Sandro Santilli <strk>
Project Member
Mon Jul 20 20:28:27 2009, comment #4:

Other difference: onUnload doesn't really destroy the DisplayObject, but only its contents, compare the following:

createEmptyMovieClip('a', 1);
a.onUnload = function() { trace('unloaded'); };
_root.onUnload = function() { trace('unloaded _root'); };

a.lineStyle(10, 0);
a.moveTo(100, 100);
a.lineTo(200, 200);

trace(a.getBounds().xMin);

//a.removeMovieClip();
a.unloadMovie();

fun = function() {
trace("fun, a is "+typeof(a));
a.loadMovie('green.jpg');
};

setTimeout(fun, 1);
trace(a.getBounds().xMin);

The removeMovieClip vs. unloadMovie.
Make sure green.jpg is in the same dir the .as above is.
You'll notice that after a.unloadMovie you can still load into it
while 'a' is undefined after removeMovieClip.

Sandro Santilli <strk>
Project Member
Mon Jul 20 20:18:31 2009, comment #3:

I've found the first difference:
::removeMovieClip will NOT remove static characters
while ::unloadMovie will (try replacing a.unloadMovie with _root.unloadMovie and compare with _root.removeMovieClip)

Sandro Santilli <strk>
Project Member
Mon Jul 20 19:48:10 2009, comment #2:

It seems that the bug exposed by my patch is indeed also a bug for the .removeMovieClip case. That is getBounds still return the full bounds of an unloaded/removed clip before it really gets destroyed.
A simple testcase:

createEmptyMovieClip('a', 1);
a.onUnload = function() { trace('unloaded'); };

a.lineStyle(10, 0);
a.moveTo(100, 100);
a.lineTo(200, 200);

trace(a.getBounds().xMin);

a.removeMovieClip();
//a.unloadMovie();

trace(a.getBounds().xMin);

You'll notice NO difference in the removeMovieClip and unloadMovie. If anyone feels like trying harder to make them different it will help.

Sandro Santilli <strk>
Project Member
Sat Jul 18 07:36:51 2009, comment #1:

I found out that the testsuite gives a failure with this
patch applied:

FAIL: astests-v8-Runner: expected: 101 obtained: 6710886.35 [/usr/src/gnash/gnash-head/testsuite/actionscript.all/MovieClip.as:898]

Sandro Santilli <strk>
Project Member
Fri Jul 17 20:04:12 2009, original submission:

Attached is a wonderful game which suffer from a blinking
wording not going away. UNIMPLEMENTED unloadMovieclip sounded
like the culprit so I tried implementing that as MovieClip.unload() and indeed fixed that game.

Well, this bug is a reminder as I don't have time to do the
fix properly, but for sure this version does fix that game

Sandro Santilli <strk>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #18431:  paci.swf added by strk (79kB - application/x-shockwave-flash)
file #18432:  unloadMovie.patch added by strk (377B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by strk (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Jul 17 20:06:25 2009strkCategoryNone=>ActionScript
    Fri Jul 17 20:04:12 2009strkAttached File-=>Added paci.swf, #18431
      Attached File-=>Added unloadMovie.patch, #18432

    Back to the top


    Powered by Savane 3.1-cleanup