A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: attaching an swf file to a button on a web page

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Southern Germany

    attaching an swf file to a button on a web page

    I AM STRUGGLING OVER SOMETHING THAT SHOULD BE BASIC. The funny thing is that NOWHERE can I find this presumably-simple task clearly explained. Or is it me?

    I want to CLICK A BUTTON (image or FLASH button?? either is OK, but which should I use?) and have it play a short Flash swf file (a sound)

    I have managed to get the swf file working AND to insert it into an HTML page using a FLASH button (I can't get it to work with behaviours).

    BUT, when I click the Flash button to PLAY the sound, the HTML page disappears ....

    This is viewable HERE!!

  2. #2
    Senior Member
    Join Date
    May 2008
    The reason the html page disappears is because the button is set to load the .swf, not play it. Check the browser address bar after you press the button to verify:
    Then once that .swf is loaded in the browser (replacing the html page), the browser then plays the sound.
    Best way to fix that is to combine the button function and the sound into one .swf and then place that .swf file on the HTML page. Don't use a separate button.
    The combined .swf file could have a button symbol in frame 1 (as well as a stop(); action). Then onRelease, it will gotoAndPlay frame 2, where the sound is. At the end of the sound put a gotoAndStop back at frame 1 to reset the button.
    Best wishes,
    Eye for Video

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center