473,385 Members | 1,320 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,385 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 3718
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.