Preloading Yahoo! Map
October 25th, 2006
in a Flash application has been an issue that I have not got around to solving until recently. Grant Skinner explained how to preload class based Flash apps in his blog post “Internal Preloading in Flash MX 2004″. The problem with the Yahoo! map component arises when you try to use the PanTool and the compiler claims that this class is unavailable. It seems that the PanTool class is not getting loaded at the right time. Playing around with this I found that instantiating the PantTool object in the map init event handler seems to work. Download the source FLA to see the whole setup.
import com.yahoo.maps.tools.PanTool;
map.addEventListener(
com.yahoo.maps.api.flash.YahooMap.EVENT_INITIALIZE,
onInitMap);
function onInitMap(eventData) {
map.addTool(new com.yahoo.maps.tools.PanTool(), true);
}
Categories: Uncategorized
