|
May 20, 2001 Sharing Methods among Frames Tips: May 2001
Yehuda Shiran, Ph.D.
|
|
In some of your applications you may need to use Flash Audio and JavaScript directly, without any prepackaged APIs such as FlashSound JavaScript API. You will enjoy more features, methods, and properties, but you'll have to take care of all the tiny details that are taken for granted when using FlashSound API. One of these "tiny" details is embedding the sound track on each and every page you want to sonify. This may become a nightmare for maintenance, once you want to change the embedded track on all pages. Another way to embed a sound track is to use an invisible frame for the sound, and change only the visible frame. In this way, we have a site that includes two frames: one fixed frame with the embedded SWFs, and one frame that hosts the regular site's Web page. When we jump from this frame to another Web page, the new page positions itself in the same frame under the same frameset. All Web site's pages access the same Flash sound object in the invisible frame. In this way, you maintain the sound embedding in a single file, serving all Web site's pages. You access an object or a method from another frame like this:
Let's see these frames in a demo. Our invisible frame is called swf, and it includes the hello() function:
Click here to see a page with two frames, one invisible and one visible. Click the
This is the code for the invisible frame:
This is the code for the visible frame:
And this is the code for another visible frame:
People who read this tip also read these tips: Look for similar tips by subject: |
| ||||||||||||||||||||