Actionscript 2.0 to 3.0

Permabanned
Joined
28 Feb 2006
Posts
1,604
Basically,

I want to convert the following code to actionscript 3.0, therefore I can use external data (eventually want people to just be able to edit a notepad file, and the news headlines will show in the video) - only AS3 does this i think!

This basically is a flashvideo on the homepage, which links to the news section, but rolls through a few headlines. - Need it to be be easily editable for people working here, therefore I think it needs to grab external data! - If anyone can point this aswell in the right direction that would be great.


So the brains of ocuk please help!!!

if (counter == 1) {
txt1 = "Hull FC seek to maximise their return...";
url_link = "/news/";
} else if (counter == 2) {
txt1 = "Chill Factore takes to the slopes with CRM...";
url_link = "/news/";
} else if (counter == 3) {
txt1 = "Ipswich Town sign up for the Green's";
url_link = "/news/";
} else if (counter == 4) {
txt1 = "Soccerex plan to improve their game by the power of 4...";
url_link = "/news/";
} else if (counter == 5) {
txt1 = "Leyton Orient communicate with the power of 4...";
url_link = "/news/";
} else if (counter == 6) {
txt1 = "Microsoft endorse Green 4 Solutions with Gold Partner Status...";
url_link = "/news/";
} else if (counter == 7) {
txt1 = "Green 4 delivers CRM to Norwegian football clubs...";
url_link = "/news/";
} else if (counter == 8) {
txt1 = "Green 4 is odds-on favourite for Jockey Club Racecourses...";
url_link = "/news/";
}
 
Last edited:
Cheers for the heads up...you deffo sure that that could be the solution to get around this?

Will attack the "project" tomorrow morning....will take a read over tonight though!

Cheers again, and I'll make sure I fire questions at you if needed :D
 
best solution, i don't know as i'm not up to date with AS 3.0 but it's a good solution :) you could find a widget at a place like flashkit but it's nice to make your own and this is a good project to learn from, having just two strings.. the more little things you learn to do with flash, the bigger things you can do by blending them.

quick xml example:

headlines.xml
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<list>
	<item title="Blah1" url="/news1/" />
	<item title="Blah2" url="/news2/" />
	<item title="Blah3" url="/news3/" />
</list>

AS 2.0
Code:
var i:Number;
var newsXML:XML = new XML();
newsXML.ignoreWhite = true;
newsXML.load("headlines.xml");
newsXML.onLoad = function(success:Boolean) {
	if (success == true) {
		var aNews:Array = this.firstChild.childNodes;
		for (i=0; i<aNews.length; i++) {
			var sTitle:String = aNews[i].attributes.title;
			var sUrl:String = aNews[i].attributes.url;
			// create and position item here, for now just trace
			trace("Title["+i+"]: "+sTitle);
			trace("URL["+i+"]: "+sUrl);
		}
		// code to setup-start animation
	} else {
		//xml not found code, if you want any error code or whatever
	}
};

edit: error with the above, i declared the var aNews twice :o removed first line.
 
Last edited:
Back
Top Bottom