destroy swiff object

a place to get help

Moderator: 1.2 Moderators

Forum rules
  • Every time you need help create a new thread (but please use the search function before, as your problem maybe has already been solved)
  • use code highlighting (help)
  • After your problem has been solved you have to rename the subject to "[solved] <Topicname>" AND set the Topic icon as solved (the green check)

destroy swiff object

Postby davcaffa on Tue Feb 09, 2010 5:51 am

I have a problem with my script when I try to destroy the swiff object.

I create my swiff obj normally:

  1. var obj = new Swiff('myMovie.swf', {
  2.     id: 'myBeautifulMovie'
  3.     width: 500,
  4.     height: 400,
  5.     params: {
  6.         wmode: 'opaque',
  7.         bgcolor: '#ff3300'
  8.     },
  9.     vars: {
  10.         myVariable: myJsVar,
  11.         myVariableString: 'hello'
  12.     },
  13.     events: {
  14.         onLoad: myOnloadFunc
  15.     }
  16. });
  17.  


this work fine, but when I try to destroy the swift obj can't make this :(

I try


but firebug sayd me : obj.dispose is not a function

but if I write this:


the alert print me [Object object]

help me please :?
davcaffa
mootools connoisseurs
 
Posts: 26
Joined: Thu Jan 22, 2009 6:08 pm

Re: destroy swiff object

Postby daKmoR on Tue Feb 09, 2010 10:54 am

from the docs: http://mootools.net/docs/core/Utilities/Swiff
Note:
1. Although Swiff returns the object, this element will NOT have any Element methods applied to it.
2. The $ function on an object/embed tag will only return its reference without further processing.


so I guess you have to select is somehow differently... a $('id').dispose(); should do
and try to not use alert... use Firebug or any other system that supports console.log
"Speak when you are angry and you will make the best speech you will ever regret." - Ambrose Bierce
User avatar
daKmoR
Site Admin
 
Posts: 860
Joined: Mon Jul 14, 2008 11:40 am

Re: destroy swiff object

Postby davcaffa on Tue Feb 09, 2010 7:13 pm

ok try to explicate better what is my problem :D

here is a sample:
http://mootools.net/shell/v7LtU/6/

I use swiff for with a mp3 player in a page where I have lot of mp3 files; Than I permit to open various link and listen music in the flash player ... ok it's work fine and when I click on other link and have the player that is play a song, stop the song and open a new div with the mp3 player this in opera, safari for windows and firefox ... internet explorer close the div but don't stop song :(

for this reason I need to destroy the swiff object ....

any ideas ?
davcaffa
mootools connoisseurs
 
Posts: 26
Joined: Thu Jan 22, 2009 6:08 pm

Re: destroy swiff object

Postby fiote on Wed Feb 10, 2010 3:18 am

Did you even tried what daKmoR said?

so I guess you have to select is somehow differently... a $('id').dispose(); should do


In your case:
  1. document.id('myBeautifulMovie').dispose();
$5 bucks for a little code almost-ready to use! Send me a PM =]
(its for a good cause man! i need to pay my wow account ^^)
User avatar
fiote
mootools fan
 
Posts: 52
Joined: Sun Nov 29, 2009 3:01 pm
Location: Brazil

Re: destroy swiff object

Postby wowenkho on Sun Feb 14, 2010 11:04 am

dispose() basically removes the element from the DOM but keeps its reference in a handler. but if you use destroy(), you also remove its reference.
my sword is yours...
http://wowenkho.com

for those who want to talk with me quicker, add me on Yahoo! Messenger through my ID: michaelapeles
User avatar
wowenkho
mootools freak
 
Posts: 1194
Joined: Sat Aug 15, 2009 10:38 am
Location: Antipolo City, Philippines


Return to Help

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests