Skip to main content
Participant
November 14, 2006
Question

How to play sound only on homepage?

  • November 14, 2006
  • 6 replies
  • 360 views
I'm a newbie so apologies if this is not the appropriate place for this post.

I have a flash animation that is used for navigation. I'm adapting the animation. It is used to create the left navigation on each page. One of the layers is a sound file. this is fine but plays when ever the user goes a new page which is actually annoying.

I want to keep the sound playing when the home page loads (/index.asp) but want to disable this when the page is anything other than /index.asp.

Is this possible in action script? Can you give me examples of the code and where and how I would implement this.

As I say, I'm a newbie to flash so any help very gratefully appreciated.

Cheers

M
This topic has been closed for replies.

6 replies

mbeedub1Author
Participant
November 17, 2006
No that didn't seem to work.

It is possible to get a popup to appear when the final swf runs in the page to tell me what the value of this._url is.

I tried Alert.show(this._url) but that didn't work.

Any other suggestions gratefully recieved.
kglad
Community Expert
Community Expert
November 18, 2006
for debugging purposes place a dynamic textfield (with instance name tf) on-stage in you navigation swf.

in frame 1 of you navigation swf attach

mbeedub1Author
Participant
November 17, 2006
No, I have the flash file in an ASP include that appears on every page
kglad
Community Expert
Community Expert
November 17, 2006
try:

kglad
Community Expert
Community Expert
November 16, 2006
are you using a html frameset?
mbeedub1Author
Participant
November 15, 2006
Hi Again

Thanks for that. The thing is that this swf is used on everypage as the left navigation. I do want the sound to play when the page loads but I only want it to play for the home page of the site (i.e index.asp) and I don't know how to test or query what page I'm on using action script.
kglad
Community Expert
Community Expert
November 15, 2006
attach the first two lines to frame 1 of your swf.

attach the 3rd line whereever you want your sound to start. that may be right after the first 2 lines if you want the sound to start when your swf starts.

attach the 4th line (without comment indicator //) where you want your sound to stop. that may be attached to a button that directs the user to a new page.
kglad
Community Expert
Community Expert
November 15, 2006
right click on your sound in your library, click linkage, tick export for actionscript and assign a linkage id (say soundID). you can then use:

mbeedub1Author
Participant
November 15, 2006
Thanks kglad

I've done that but it's not really clear to me how I test the name of the file (i.e. /index.asp) and where I should put the code to do that.

As I say, I really am very new to this.

Cheers