Jump to content

XML AS3 Image Hyperlinks


Manny

Recommended Posts

Hi all. Having a few problems with AS3, I've tried a few sources on the web but unable to find a working solution as yet.Take a look at this page. Visit My WebsiteThe club crests you can see at the top are displayed using XML and its where I want to take my version on my website.Here is my version. Visit My WebsiteMine was created in Flash and saved as AS2. But I was hoping to go behind the scenes and import the images using XML and in AS3. I was given some code but there are errors.Here is my code:

package {var xml_loader:URLLoader = new URLLoader();var db:XML = new XML();xml_loader.addEventListener(Event.COMPLETE, db_yuklendi);xml_loader.load(new URLRequest("http://www.burndenaces.co.uk/XML AS/teams.xml"));import flash.events.Event;function db_yuklendi(event:Event):void {	db = new XML(event.target.data);	var image_count:int = db.item.length();	olustur(image_count,db);}var main_ekran:ana_ekran = new ana_ekran();function olustur(image_count:int,data:XML) {			amovieclip.clubs.text = data.item. crest.text()[0].toString();for (var i:int; i<image_count; i++) {						var thumbnail:kucuk_ekran = new kucuk_ekran();				var adres:String = data.item. crest.text()[i].toString();		var xml_adres1:URLRequest = new URLRequest(adres);		var setLink = data.item.collar.text()[i].toString();		thumbnail.link = setLink		thumbnail.load(xml_adres1);		thumbnail.bos_buton.addEventListener(MouseEvent.MOUSE_DOWN, clicked);		thumbnail.bos_buton.addEventListener(MouseEvent.ROLL_OVER, rollover);		thumbnail.bos_buton.addEventListener(MouseEvent.ROLL_OUT, rollout);		bos_mc.addChild(thumbnail);		}	}

This brings back the error: 1084: expecting rightbrace before end of program.But when I add the rightbrace to my code, it returns 17 errors, all of which are shown below. Does anybody have the knowledge to give me a helping hand.errorskm3.jpgThanks,Manny

Link to comment
Share on other sites

You really are missing a right brace at the end of your code. Add it and repair each error individually.ActionScript 3 has quite different ways of using and accessing objects than ActionScript 2. I'm not the biggest expert, but you DO have to put that right brace. Then find out why the other errors are happening.

Link to comment
Share on other sites

Yeah, I've put the rightbrace in at the end of my code. That error disappears but then those other 17 appear.I'm used to AS2 and the design stage of Flash but a newbie to the scripting side of AS3, which is kinda giving me the problems. Searching Google is my best option at the moment. For such a little amount of code, there appears to be so many errors!

Link to comment
Share on other sites

When passing ActionsScript 2.0 code to ActionScript 3.0 you get a lot of errors, they're almost like two different programming languages.ActionScript 3.0 is very strict.

Link to comment
Share on other sites

While my knowledge of AS3 is still poor, would you recommend I did what I want to do using PHP. I'm quite experienced in this field with an SQL database.I could put the info I need in rows and then call upon the rows I want in a query.

Link to comment
Share on other sites

You can use PHP with databases, or you can use PHP with XML, and then additionally give the icons a "title" attribute with the name of the club. The advantage with this is that search engines can recognise them as links and follow them.Flash menus are somewhat discouraged because they are worse for Search Engine Optimization. I only use flash to make special applications that I can't do with Javascript or PHP.

Link to comment
Share on other sites

There you go. Two days messing around with Actionscript left me with error after error. 10 minutes using PHP MySQL and I get almost the same thing.See HereThanks for your help Ingolme.

Link to comment
Share on other sites

I recommend you add this to your premcrest CSS:.premcrest {display: inline;}You're obviously developing in Internet Explorer.

Link to comment
Share on other sites

I've added that piece of code to my style sheet, although it doesn't seem to have made any difference?As for developing, I'm using Dreamweaver CS3 but testing in Firefox. I check IE and Opera every now and then to make sure everything works.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...