Actionscript 3.0

Dynamic content games

The project city match

http://www.casualgamedesign.net/city-match-2/

 

aims to demonstrate a variety of different content imports.

The full game at the moment is 2MB in file-size but the different game set-ups are endless. Moreover, to add more cities and game content, all it takes it to edit a single xml file.

So what is dynamic ?

1. Importing City information from Wikipedia ( Inhabitants, country and country flag)

2. Importing city maps from Wiki Commons http://commons.wikimedia.org/ ( includes tracing out white backgrounds and colouring)

3. Importing 3d Building from the Google3dWarehouse – Scaled and positioned in Papervision3d

4. Importing Weather data from World Weather Online – Weather conditions are translated to different background images

5. Importing random images from Flickr.com - The program access the “most insteresting” creative commons licensed pictures and chooses 6 randomly.

For more information on how the content is loaded please visit the Honours Project section

Please comment and discuss.

Print Friendly

Getting the weather

After a long search for a free service that allows requesting weather data through latitude and longitude information I finally found worldweatheronline.com

They give you an easy to access xml API that lets you request current weather data and forecast. Here is my test script requesting the weather data at about the point where Edinburgh Napier Uni is.

and this is the code

var xmlLoader:URLLoader=new URLLoader  ;
var xmlData:XML=new XML  ;

var currenttemp:String;
var currentcond:String;

xmlLoader.addEventListener(Event.COMPLETE,LoadXML);

xmlLoader.load(new URLRequest("http://free.worldweatheronline.com/feed/weather.ashx?q=55.93,-3.22&format=xml&num_of_days=2&key=#thissiwhereyourAPPIkeygoesin"));

function LoadXML(e:Event):void {
    xmlData=new XML(e.target.data);
    ParseWeather(xmlData);
}

function ParseWeather(weather:XML):void {

      currenttemp = weather.current_condition.temp_C;
    currentcond = weather.current_condition.weatherDesc;
    trace(currenttemp);
    weathertext.text = "In Edinburgh it is currently \n" +currenttemp + " C and " +currentcond;
}
Print Friendly

Importing Google Earth files dynamically into Papervision3D – Scaling & positioning


Loading Google Earth models into flash, dynamically. The files are loaded directly from the web and rescaled and positioned. And this is how it is done: More »

Print Friendly

Why is my .swf so big?

I just came across a small very handy tool and thought I would share it.

http://haxer.be/SWFTools/swfcharts.swf

Put your swf in and it will give you a chart and diagram to see what makes up the file size.
Especially useful if you are struggling with long loading times.

Print Friendly

Simple Dropdown menu AS3 – .fla

Yesterday I was looking for a simple DropDown menu in Actionscript 3.0, but all I found was either made more complex than it needs to be or a 45 minute tutorial including the explanation on how to start up your computer.  So I made my own. Just 40 lines of code and that is including the rollover effect.

Simply insert your menu items in the Array. The variable selecteditem will return the selection the user made, so you can use it to work with.
For example create a function that goes to different pages when a selection is made.

If you want to make a new and fancy design make sure to leave the object in place as the AS refers to them ( Textfields have to be named, and the main menu button as well)

Download .fla

 

Print Friendly