Developer Notes

To build, you will have to pull from Subversion.


svn checkout http://svgweb.googlecode.com/svn/trunk/ svgweb-read-only

Building is currently done consistently on Mac OS X and Linux.

Windows XP is reported to build, but with some issues, using "MingW and msys" (see Issue 176 comment #4).

You need the Flex/Flash SDK, the java runtime*, and the java sdk**.

Respectively, that means mxmlc, java, and javac should be in your path.

*If you do not compress the javascript, you do not need the java runtime

**You can comment out the webserver.jar target if you have a web server and then you do not need the java sdk.

Change to the top level directory where the Makefile is.

To clobber the build:


make clean

To make a build:


make all

To control whether the JS is compressed (by default it is not):


make all COMPRESS=1

To control whether tests are copied into the build/ directory (not copied by default; these are located in tests/).


make all COPY_TESTS=1

Once building you will need to access things using the local web server as normal in build/. See the Quick Start guide for details on running the provided java webserver.

If you have your own web server, you can run the following command, which will copy files to your web server directory. Substitute the appropriate directory for your system below.


make install SVGSRV=/var/www/html

Flex Builder

We do not maintain project files for Flex Builder. However, it is not too dificult to import SVG Web into Flex Builder. You can take the following steps:

1. Create a new ActionScript Project named svgweb.

2. Navigate to the directory of the project.

(On my machine it is C:\Documents and Settings\username\My Documents\Flex Builder 3\svgweb)

3. Copy over the SVG Web src/org directory into the flex src directory.

4. Import the files. Select File Import, then select File System and the select the directories.

Actually, I don't remember if I imported the directory in-place or from a separate location in the file system. You may have to try it both ways

5. Place the svg file you want to test in the org directory.

6. Create a class in the org directory to test with. The following worked for me:


package
{
    import org.svgweb.SVGViewerFlash;
    import flash.display.Sprite;

    [SWF(frameRate="40", width="800", height="600")]
    public class SVGViewerFlashTest extends Sprite
    {
        private var svgImage:SVGViewerFlash;

        public function SVGViewerFlashTest()
        {
            super();
            svgImage = new SVGViewerFlash();
            this.addChild(svgImage);
            svgImage.loadURL("i369.svg");
        }

    }
}

Note that there is another flash oriented example for SVG Web here: src/org/svgweb/tests/SVGViewerFlashTest.as

You can see how to load these examples using straight html in samples/flash-samples/ and samples/flex-samples/.

7. Import the new class file into flex builder

8. In the Flex Navigator, right click on the new class file and "Set as Default Application"

9. Modify the index.template.html file in the html-template directory.

You have to modify the FlashVars if you want to pass parameters to svgweb. This is probably not necessary if you are hard coding the URL as I have done above.

If you want to load different URLs, you could adapt code from src/org/svgweb/tests/svgflextest.mxml, which gets the URL from the FlashVars.

Here is a diff of the changes against the default index.template.html file:


65c65
<       "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
---
>       "FlashVars", "sourceType=url_svg&svgURL=i369.svg",
85a86
>           "FlashVars", "sourceType=url_svg&svgURL=i369.svg",
105a107
>                         <param name="FlashVars" value="sourceType=url_svg&svgURL=i369.svg">