1

Topic: AS3 issues with soundslide swf

I'm trying to unload my swfs with a back button, my button works but it doesn't unload the child.
Anybody please help.

I'm using the source in the example file posted here, but I need to unload with a button.

//A new request for the file you want to load
var ss_url:URLRequest = new URLRequest( "publish_to_web/soundslider.swf" );
//create a loader
var loader:Loader = new Loader();
this.addChild(loader);
// Then load the clip itself
loader.load( ss_url );

2

Re: AS3 issues with soundslide swf

You can remove the clip by calling:

this.removeChild(loader);

-joe

3

Re: AS3 issues with soundslide swf

Hi Joe,

I'm not sure where to put this code with my button, I'm new to flash.
Do you know or can you give me a more specific sample?

Thanks

4

Re: AS3 issues with soundslide swf

Hey kisacrab.


kisacrab wrote:

I'm not sure where to put this code with my button, I'm new to flash.
Do you know or can you give me a more specific sample?

I don't have a basic Flash button AS3 tutorial ... I'll see what I can do ... it may be next week.  You might get a quicker answer on a Flash AS3 forum. 

kisacrab wrote:

My credits are working but my thumbnails aren't, any idea what the problem could be?

That's a limitation of using the AS2 file in AS3.  Because of the classes that our player uses, the thumbnail menu won't work in AS3.  We have to finish the AS3 version for this to work correctly.

Please post in this thread if you have any more questions.  I'll be able to answer your AS3 questions quicker if they're all in one place.  Thanks!

-joe

5

Re: AS3 issues with soundslide swf

Hi Joe

This is urgent, if I can't find out today I have to rebuild my entire project in AS2 by tonight.

Thanks

6 (edited by joeweiss 2009-03-26 14:11:34)

Re: AS3 issues with soundslide swf

Assuming your button has an instance name of "unload_button", this code will work.

unload_button.addEventListener(MouseEvent.CLICK, unload_button_function);
function unload_button_function(self) {
    trace("stop the sound");
    import flash.media.SoundMixer;
    SoundMixer.stopAll();
    trace("remove the clip");
    this.removeChild(loader);
}

I'll update the source file if I get a chance this afternoon.

[UPDATE]

Source files updated here:
http://media.soundslides.com/files/simp … oader/?new

Scroll to the bottom of the example page to see the unload button.

-joe

7

Re: AS3 issues with soundslide swf

Thank you Joe, it works great!

xoxo

8

Re: AS3 issues with soundslide swf

Joe,

I have 4 soundslide shows in the same project, only one is unloading, the button won't make the other unload, I get a duplicate function,

what do I need to change to make them all unload?

Thanks

9

Re: AS3 issues with soundslide swf

It depends on how you loaded them and how you want to upload them. Are they all loading (one at a time) into the same loader clip? Or different clips? Do you want/need a different unload button for each slide show?

The code I provided unloads a single "loader" clip from a single button.  If you want to unload another single clip from a different button, then you need to duplicate the code, then change the names in the code and make a new unload function.  You're probably getting a duplicate function error because the name of the function was not changed when you duplicated it.

For example, if you loaded a slide show into "loader2" and had a button with an instance name of "unload2_button", this would be your code:

unload2_button.addEventListener(MouseEvent.CLICK, unload2_button_function);
function unload2_button_function(self) {
    trace("stop the sound");
    import flash.media.SoundMixer;
    SoundMixer.stopAll();
    trace("remove the clip");
    this.removeChild(loader2);
}

And if you had a third unload button for loader3, this would be it:

unload3_button.addEventListener(MouseEvent.CLICK, unload3_button_function);
function unload3_button_function(self) {
    trace("stop the sound");
    import flash.media.SoundMixer;
    SoundMixer.stopAll();
    trace("remove the clip");
    this.removeChild(loader3);
}



Now ... if you wanted to unload all of the clips from a single button, then this would be the code assuming that your loader clips were named "loader", "loader2", "loader3", "loader4" and your button was instance named "unload_button":

unload_button.addEventListener(MouseEvent.CLICK, unload_button_function);
function unload_button_function(self) {
    trace("stop the sound");
    import flash.media.SoundMixer;
    SoundMixer.stopAll();
    trace("remove the clips");
    this.removeChild(loader);
    this.removeChild(loader2);
    this.removeChild(loader3);
    this.removeChild(loader4);

}



-joe

10

Re: AS3 issues with soundslide swf

Thanks joe,

I have all the buttons working now, loading and unloading, Thank you! but I have an interesting problem. I think I posted about this in another thread. My thumbnails are working in my first slideshow now with as3, but not in the other 3 slideshows,
so I had to change the name of the loader to loader1, loader2, loader3, Do you have any idea what would cause the thumbnails not to work, did I mess something up in the code?

Thanks

11 (edited by joeweiss 2009-03-27 14:08:07)

Re: AS3 issues with soundslide swf

I'm actually surprised you got the thumbnail menu to work at all in AS3.  In the other thread (and quoted above in this thread), I said that the thumbnail menu doesn't work properly in AS3, and that the menu functionality will have to wait until we release an AS3 version.  You can disable the thumbnail menu under the Template tab in Soundslides or Soundslides Plus.

-joe