473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Load images into flash map points via xml using .text equivalent??

elamberdor
Hi All!

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
  1. function loadXML(loaded) {
  2.     if (loaded) {
  3.         xmlNode = this.firstChild;
  4.         image = [];
  5.         total = xmlNode.childNodes.length;
  6.         for (i=0; i<total; i++) {
  7.             image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  8.         }
  9.         firstImage();
  10.         picture._alpha = 100;
  11.         picture.loadMovie(image[0], 1);
  12.     } 
  13. }
  14. xmlData = new XML();
  15. xmlData.ignoreWhite = true;
  16. xmlData.onLoad = loadXML;
  17. xmlData.load("SVW_SampleData.xml");
  18.  
  19.  

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
  1. function processData(success) {
  2.     if (success) {
  3.         movie_Width = Stage.width;
  4.         movie_Height = Stage.height;
  5.         var rootNode = this.firstChild;
  6.         var dataNodes = rootNode.childNodes;
  7.         var dataItemsCount = dataNodes.length;
  8.         minLat = parseFloat(rootNode.attributes.minLat);
  9.         minLng = parseFloat(rootNode.attributes.minLng);
  10.         maxLat = parseFloat(rootNode.attributes.maxLat);
  11.         maxLng = parseFloat(rootNode.attributes.maxLng);
  12.         var dataPoints:Array = new Array();
  13.         for (var i = 0; i<dataItemsCount; i++) {
  14.             dataPoints[i] = _root.attachMovie("sym_marker", i.toString(), i+1);
  15.             dataPoints[i].txt_Label.text = dataNodes[i].attributes.image;
  16.             dataPoints[i]._x = GeoToPixel(parseFloat(dataNodes[i].attributes.lng), minLng, maxLng, movie_Width);
  17.             dataPoints[i]._y = GeoToPixel(parseFloat(dataNodes[i].attributes.lat), minLat, maxLat, movie_Height);
  18.         }
  19.     } else {
  20.         trace("XML Data Not Found");
  21.     }
  22. }
  23. function GeoToPixel(inPoint:Number, inMin:Number, inMax:Number, inMovieDimension:Number):Number {
  24.     return (Math.abs(inPoint)-Math.abs(inMin))/(Math.abs(inMax)-Math.abs(inMin))*inMovieDimension;
  25. }
  26. var xmlData = new XML();
  27. xmlData.ignoreWhite = true;
  28. xmlData.onLoad = processData;
  29. xmlData.load("SVW_SampleData.xml");
  30. var minLat:Number, minLng:Number, maxLat:Number, maxLng:Number;
  31. var movie_Width:Number, movie_Height:Number;
  32.  
(here's the xml file for this for you too:)
Expand|Select|Wrap|Line Numbers
  1. <Advertisers identifier="Food &amp; Wine" datestamp="9-AUGUST-2008 14:50:23"
  2.     minLat="-35.1738083"
  3.     maxLng="148.4912109"
  4.     maxLat="-36.5295019"
  5.     basemap="map_SVWBaseMap.png"
  6.     minLng="146.0687255" categoryid="3">
  7.  
  8.     <Advertiser advertiserid="3" name="Wangaratta" description="get excited!"
  9.              image="icons_silver_art.gif" icon="icons_silver_art.gif"
  10.              lat="-36.3549" lng="146.3076" url="http://www.jammedia.com.au">
  11.     </Advertiser>
  12. </Advertisers>
  13.  
Okay, i'm trying not to get confusing...

the question i'm asking about is in this line of the above code:
Expand|Select|Wrap|Line Numbers
  1. dataPoints[i].txt_Label.text = dataNodes[i].attributes.image
  2.  
I would like some sort of image equivalent code here, instead of calling to a text field called "txt_label" and the suffix of ".text", is there a way to word my above load image script using a blank movie clip, calling to an image linked via the xml from "image" or "icon" field into this line to suit?

Any feedback/ideas at all would be muchly appreciated!
Thanks as always!
=)
Aug 27 '07 #1
2 3719
Hi Again,
I'm sorry, I just realised this may be better suited to the actionscript forum...
I won't re-post to save grumbles, but apologies all the same!
Aug 27 '07 #2
Hi All?
Any Ideas?

Found this on Googlemaps, I think it might be close...
Expand|Select|Wrap|Line Numbers
  1. return new Icon1(c.getAttribute("image"),s)
  2.  
and i'm trying things like:
Expand|Select|Wrap|Line Numbers
  1. for (var i = 0; i<dataItemsCount; i++) {
  2.             datapoints[i].image = picture.loadMovie(image[i], 0, i.toString(), i+1);
  3.             picture._alpha = 100;
  4.  
any ideas would be great!
Thanks!
=)
Aug 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John | last post by:
Hi, we have the following problem: in our application v1.0 we have static html pages (+ some javascript). With a CMS (a Content Management System) some "mortal" people can add or expand the...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
61
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the...
0
by: mrjaxon | last post by:
Basically the issue is, when the XSL style sheet is loaded by URI it is cool but when the exact same style sheet loaded by it's contents the load fails (for this particular style sheet). Because...
1
by: Steve Belanger | last post by:
Hi, i am creating a 'design online' flash tool that allows me to design something with flash, throwing graphics and text elements. i then export that using XML data and have PHP create a jpeg...
2
by: gunnuk | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
1
by: Tea Maker | last post by:
Hi, Is there a way in actionscript, to tell a specific button to load the image from a folder that exist in the same root of the flash file? Let's say I have one button in flash that is called...
0
by: mkumar20xx | last post by:
hi Guys, I am a beginner in flash. i have made some flash movies and have some understanding on actionscripts. my question is how to make flash movie which will dynamically load thumbnail...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.