[mapserver-users] Re: flash swf output

Florin A. pianosnake at gmail.com
Thu Apr 10 09:54:18 PDT 2008


The reason to have names for the buttons is so that the loader swf can
reference them with Action Script and change their color, position, etc...
This could be done even without having names, because at runtime the Flash
player assigns to each movie clip a name if it does not have one. These are
called 'instance1', 'instance2', 'instance3' etc...  These can be referenced
by Action Script.

Unfortunately, the buttons in the SWF output from MapServer can't be
referenced by ActionScript at all. Neither with the 'instance1' syntax, nor
with the new 'button212', 'button213', etc  names that are assigned to the
buttons with this fix. I am not sure why this is.

I've created a few Ming movies to test this.  Make a simple movie in MING
with two buttons. Don't give them names.  Then create a Flash movie with two
buttons named thebtn, and  one called loadming, a blank movie on the stage
called swfContainer, and  this actionscript which will load
ming_output.swf.

var mcLoader:MovieClipLoader = new MovieClipLoader();

thebtn.onRelease = function() {
    for (var mcname in swfContainer) {
        trace(mcname);
        if (mcname == "instance2") {
            _root.swfContainer[mcname]._x += 10;
        }
    }
};
loadming.onRelease = function(){
mcLoader.loadClip("ming_output.swf", swfContainer);
}


If you load any Ming swf with this script, you'll be able to move 10 pixels
to the right anything in that swf called instance2.  If you load a MapServer
swf you won't be able to do this. All of the buttons in the swf will move 10
pixels to the right because   _root.swfContainer.instance1  returns a
reference to the parent _root.swfContainer  .     I'm trying to look at the
mapswf.c code to see why this might be happening, but its over 3000 lines,
so it will be a while, unless anybody has some ideas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080410/503ac386/attachment.htm>


More information about the MapServer-users mailing list