Showing posts with label AS3. Show all posts
Showing posts with label AS3. Show all posts

Thursday, December 17, 2009

Basic ActionScript 3 XML Gallery

I built a gallery with actionscript 3 that runs off xml. Below you can view it or download the source files.

[ SEE IT IN ACTION ]
[ DOWNLOAD THE FILES ]

Issues this covers: ActionScript 3, AS3, Gallery, XML, Preloader, Preload external files, Tween Class, enterframe, Mouse events, Arrays, addChild, removeChild

Thursday, December 18, 2008

Neumont Widget

I had to make this widget for Neumont University and since it was a pretty simple app I decided to do it in AS3:






This pulls from an XML file that is on their server and rotates through news and events. You can download the files here:

[DOWNLOAD]

The xml file is in there, although you'll have to change the link in the flash if you really want it to pull from that xml because right now it is pulling the xml off Neumonts server.

Issues this covers: setTimer, new setInterval, dynamic text, XML, parsing, URLRequest, getURL, AS3, Actionscript 3.0

Wednesday, June 18, 2008

Loading XML and Parsing with AS3

This is what the XML doc looks like:
<images>
<pic>
<image>photos/pic17.jpg</image>
<thumb>thumbs/pic17.jpg</thumb>
<title>Kevin's Evil Face</title>
<desc>This is Kevin layin down some tracks. Boho Digitalia - February 2008</desc>
</pic>
<pic>
<image>photos/pic18.jpg</image>
<thumb>thumbs/pic18.jpg</thumb>
<title>Matt</title>
<desc>This is Matt singin some live bgv's</desc>
</pic>
<pic>
<image>photos/pic26.jpg</image>
<thumb>thumbs/pic26.jpg</thumb>
<title>The 4923</title>
<desc>Once upon a time, Matt wasn't in the band yet and Kevin played bass. Kilby Court - A Really Long Time Ago</desc>
</pic>
</images>

And this is how you load it into Flash and parse it:
var thumbs:Array = new Array();
var images:Array = new Array();
var titles:Array = new Array();
var descs:Array = new Array();

///////////////////////////////////
///// vvvvvv LOAD XML vvvvvv //////
//+++++++++++++++++++++++++++++++//
var loader:URLLoader = new URLLoader();
var xml:XML = new XML();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("images.xml"));
function loadXML(event:Event):void{
xml = new XML(event.target.data);
var total:Number = xml.pic.length();
for(var i:int = 0; i < total; i++){
thumbs[i] = xml.pic.thumb.text()[i];
images[i] = xml.pic.image.text()[i];
titles[i] = xml.pic.title.text()[i];
descs[i] = xml.pic.desc.text()[i];
}
loadThumbs();
}
//+++++++++++++++++++++++++++++++//
///////////////////////////////////
///////////////////////////////////

///// LOAD THE THUMBNAILS /////
function loadThumbs():void{
// do whatever you need here
trace(thumbs);
}

This will make 4 arrays (thumbs, images, titles, descs) and populates them with everything from your XML file. I still haven't taken the time to figure out how to parse it into a 2D array, so if anyone wants to tell me how to do it, that would rock.

Friday, June 13, 2008

As3 Music Player

I reprogrammed the player I made for my band's website in as3. Check it out:



Download Files

Somehow, and who knows how, the songs load super fast with the new sound object, which is awesome! I didn't even need to put a preloader on this one (which is good since I don't know how to make one yet). Some things about sound now are a little different but they aren't too annoying. The bar goes a little crazy when you click on it (to go to a different section in the song). It doesn't so that when I just export the swf. I'm hoping it's just some weird blogger thing.

Issues this covers: AS3, Actionscript 3.0, Sound, SoundChannel, SoundTransform, volume