Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed a couple typos in the code

...

Code Block
protected void onComponentTag(ComponentTag tag) {
        super.onComponentTag(tag);
        tag.put("width", WIDTH);
        tag.put("height", HEIGHT);
    }

 and finally to ensure that your markup is created correctly to display the Flash, you must override and implement onComponentTagBody as such:

Code Block
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {

        StringBuffer flashBuffer = new StringBuffer();

         // in the following, we will append all the necessary body tags of flash markup
        flashBufferappendflashBuffer.append("<param name=\"movie\" value=\"");

        // urlFor will  provide the link that will stream the flash byte array
        flashBuffer.append(urlFor(IResourceListener.INTERFACE));
        flashBuffer.append("\"/>");
        flashBuffer.append("<embed src=\"");
        flashBuffer.append(urlFor(IResourceListener.INTERFACE));
        flashBuffer.append("\" width=\"");
        flashBuffer.append(WIDTH);
        flashBuffer.append("\" height=\"");
        flashBuffer.append(HEIGHT);
        flashBuffer.append("' quality=\"high\" name=\"movie\" align=\"middle\" plug inspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\">");
        replaceComponentTagBody(markupStream, openTag, flashBodyflashBuffer);
    }

That is all that is required of the component to provide the Flash resource, and build the body markup.  Finally, you want the actual markup (.html) of whoever adds this component, to look like this:

...