Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-04-2010, 03:58 PM   #1
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default Captivate CS4 and the Lingering event listeners

Hello

I've seen this problem all over the as2 forum, but I haven't seen it here.

I created a flash app(created with flash cs3) that can dynamically load content (such as swf, flv, images) into the app.

It has worked fine until I started using captivate 4 swf files.

They are dynamically loaded into the the app, but once discarded I suspect it's event listeners still linger after the captivate swf has been removed (using removeChildAt).
I don't know how to reference them to analyze them, or even know if this is the problem.

Output:

Error: #1009: blah blah blah
at captivate.Veela_AS3::rdClickHandler/captivate.Veela_AS3::MouseInPlayBar()
captivate.Veela_AS3::rdClickHandler/captivate.Veela_AS3::CheckAllClickDowns()
captivate.Veela_AS3::rdClickHandler/captivate.Veela_AS3:nMousePress()


This happens only after a captivate swf has been loaded and then discarded.

My search for a solution so far has only yielded other people complaining about this same problem.

Last edited by Yikes; 01-06-2010 at 04:19 PM. Reason: typos
Yikes is offline   Reply With Quote
Old 01-05-2010, 07:13 PM   #2
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default

Adobe support wasn't much help so far. They directed my to the adobe forums where I found someone else having the same issue, and no solution.
Yikes is offline   Reply With Quote
Old 01-05-2010, 07:29 PM   #3
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,860
Send a message via Skype™ to henke37
Default

Loader.unloadAndStop or just get the loaded swf files to listen for the REMOVED event and make them turn themself off when being removed.
henke37 is offline   Reply With Quote
Old 01-05-2010, 09:34 PM   #4
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default

Quote:
Originally Posted by henke37 View Post
Loader.unloadAndStop or just get the loaded swf files to listen for the REMOVED event and make them turn themself off when being removed.
Thanks for the response.

Unfortunately I am still using flash CS3, and I think unloadAndStop is a CS4 addition.

Know any good hacks?

I did find this article on the issue though

http://kb2.adobe.com/cps/403/kb403670.html

It seems like a good starting point.

I'm going to download the flash CS4 trail and see if that solves the problem, and if it pans out I will let you know.

I would love to be able to reference the captivate event listeners to remove them, but I am not aware of any resources for that yet.
Yikes is offline   Reply With Quote
Old 01-06-2010, 02:50 AM   #5
Lou22
Member
 
Join Date: May 2009
Posts: 74
Default

Would it make any difference to nullify it before you removeChild it?
Lou22 is offline   Reply With Quote
Old 01-06-2010, 04:49 AM   #6
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default

Quote:
Originally Posted by Lou22 View Post
Would it make any difference to nullify it before you removeChild it?
in what way?
Yikes is offline   Reply With Quote
Old 01-06-2010, 05:20 AM   #7
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default

Quote:
Originally Posted by henke37 View Post
Loader.unloadAndStop or just get the loaded swf files to listen for the REMOVED event and make them turn themself off when being removed.
Using the unloadAndStop before removing it from the stage works better. The problem still persists but is greatly dinimished. I might just have to buy that upgrade.

I created a project file to isolate the problem.
Here is the relevant code:

ActionScript Code:
import flash.display.Loader; var movieRequest:URLRequest = new URLRequest("lessons/aCaptivateSWF.swf"); var movieLoader:Loader = new Loader(); var lessonMovie:MovieClip = new MovieClip(); addChild(lessonMovie); movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(evt:Event):void{     var lessonMovieClip = MovieClip(movieLoader.content);     lessonMovie.addChild(lessonMovieClip); }); load_btn.addEventListener(MouseEvent.MOUSE_DOWN,function(evnt:Event):void{     movieLoader.load(movieRequest); }); delete_btn.addEventListener(MouseEvent.MOUSE_DOWN,function(evnt:Event):void{     //trace("Movie unload");     movieLoader.unloadAndStop();     //trace("remove from the stage");     removeChildren(lessonMovie);     //trace("so far so good"); }); function removeChildren(s:Object):void{     var n:int = s.numChildren;     //trace("numchildren: ", n);     while(n--){         //trace("numchildren: ", n);         s.removeChildAt(n);     }     //trace("Done removing children ",n); }

suggestions welcome

Last edited by Yikes; 01-06-2010 at 04:19 PM. Reason: typo
Yikes is offline   Reply With Quote
Old 01-08-2010, 08:27 PM   #8
Yikes
Member
 
Join Date: Jan 2010
Location: SC
Posts: 67
Default

Anybody know if the event listeners in captivate CS4 are strongly or weakly referenced?
Yikes is offline   Reply With Quote
Old 04-14-2010, 07:17 PM   #9
kkaushik
Registered User
 
Join Date: Apr 2010
Posts: 1
Default Any solution to this problem??

Hi,

Has anyone found the solution to this problem yet? I am getting exactly same error when I try to unload a "Adobe captivate" generated swf, and immediately load a new one.


TypeError: Error #1009: Cannot access a property or method of a null object reference.
at captivate.Veela_AS3::rdClickHandler/MouseInPlaybar()
at captivate.Veela_AS3::rdClickHandler/CheckAllClicksDown()
at captivate.Veela_AS3::rdClickHandler/onMousePress()


I have tried using the "unloadAndStop" function that is usually recommended, but to no use. I am attaching my code below. Kindly point out if I am doing anything wrong in that.

Thanks,
Kapil

******************
Code
******************

//consider that swfLoader is the current class member and
//that "swfLoader = new Loader()" is done once

private function loadExternalSwf(swfPath:String):void
{
//unload previous swf
swfLoader.unloadAndStop();

//load new swf
var url:URLRequest = new URLRequest(swfPath);
swfLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, afterLoadingSwf);
contentLoader.load(url);
}

private function afterLoadingSwf(event:Event):void
{
var myLoader:LoaderInfo = event.target as LoaderInfo;
this.addChild(myLoader.content);
loaderInfo.removeEventListener(Event.COMPLETE, afterLoadingWizard);
}
kkaushik is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:46 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.