Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map,
..well now I want to load in icons(images) instead of text. (yes i'm being difficult)
and i'd like the text to load into a static placeholder symbol instead.
Problem is, I can get images to load in a separate file, text to load in a separate file, and text to appear in a static movieclip...but won't work together in one flash movie....
I can get images to load when load into flash in a separate flash movie, with a movie image with the instance name of picture using this code:
Expand|Select|Wrap|Line Numbers
- function loadXML(loaded) {
- if (loaded) {
- xmlNode = this.firstChild;
- image = [];
- total = xmlNode.childNodes.length;
- for (i=0; i<total; i++) {
- image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
- }
- firstImage();
- picture._alpha = 100;
- picture.loadMovie(image[0], 1);
- }
- }
- xmlData = new XML();
- xmlData.ignoreWhite = true;
- xmlData.onLoad = loadXML;
- xmlData.load("SVW_SampleData.xml");
I'll place in the working map code showing text points - as I think you might find it handy (works like googlemaps)
Expand|Select|Wrap|Line Numbers
- function processData(success) {
- if (success) {
- movie_Width = Stage.width;
- movie_Height = Stage.height;
- var rootNode = this.firstChild;
- var dataNodes = rootNode.childNodes;
- var dataItemsCount = dataNodes.length;
- minLat = parseFloat(rootNode.attributes.minLat);
- minLng = parseFloat(rootNode.attributes.minLng);
- maxLat = parseFloat(rootNode.attributes.maxLat);
- maxLng = parseFloat(rootNode.attributes.maxLng);
- var dataPoints:Array = new Array();
- for (var i = 0; i<dataItemsCount; i++) {
- dataPoints[i] = _root.attachMovie("sym_marker", i.toString(), i+1);
- dataPoints[i].txt_Label.text = dataNodes[i].attributes.image;
- dataPoints[i]._x = GeoToPixel(parseFloat(dataNodes[i].attributes.lng), minLng, maxLng, movie_Width);
- dataPoints[i]._y = GeoToPixel(parseFloat(dataNodes[i].attributes.lat), minLat, maxLat, movie_Height);
- }
- } else {
- trace("XML Data Not Found");
- }
- }
- function GeoToPixel(inPoint:Number, inMin:Number, inMax:Number, inMovieDimension:Number):Number {
- return (Math.abs(inPoint)-Math.abs(inMin))/(Math.abs(inMax)-Math.abs(inMin))*inMovieDimension;
- }
- var xmlData = new XML();
- xmlData.ignoreWhite = true;
- xmlData.onLoad = processData;
- xmlData.load("SVW_SampleData.xml");
- var minLat:Number, minLng:Number, maxLat:Number, maxLng:Number;
- var movie_Width:Number, movie_Height:Number;
Expand|Select|Wrap|Line Numbers
- <Advertisers identifier="Food & Wine" datestamp="9-AUGUST-2008 14:50:23"
- minLat="-35.1738083"
- maxLng="148.4912109"
- maxLat="-36.5295019"
- basemap="map_SVWBaseMap.png"
- minLng="146.0687255" categoryid="3">
- <Advertiser advertiserid="3" name="Wangaratta" description="get excited!"
- image="icons_silver_art.gif" icon="icons_silver_art.gif"
- lat="-36.3549" lng="146.3076" url="http://www.jammedia.com.au">
- </Advertiser>
- </Advertisers>
the question i'm asking about is in this line of the above code:
Expand|Select|Wrap|Line Numbers
- dataPoints[i].txt_Label.text = dataNodes[i].attributes.image
Any feedback/ideas at all would be muchly appreciated!
Thanks as always!
=)