« April 2004 | Inicio | June 2004 »

May 30, 2004

Free sounds compilation

The spanish Ministry of Education offers about 5000 sounds in mp3 and wav format, that can be used freely in educational projects. If you can read spanish, it can be of your interest.

Here´s the link:

May 19, 2004

About class interfaces

Don't expect anything specially brilliant here. This is just an story that show how mastering interfaces can help you in your daily work ( as it has helped in mine )

I think I've blogged about it before, but here I go again. The last three months I've been working developing an AS2 framework to build games. We are approaching our first deadline ( next Friday ), so we don't have too much free time.

So, yesterday, I started the development of five games which are quite similar. We've called them "the disposition games", because, well, you have to place some items on screen in the right order. There are a given number of spots , and when you place one of the given items over it, some rules are checked, and then the item is placed or is moved back to its initial position.

There are five different games ( one is about placing children in the school bus, another one is about choosing the order of some tasks that must be completed before going on vacation… )

The architecture of the games is quite simple. There's a main class ( called "World" that aggregates another class called "Scenario" which contains the logic of the game ). So the world class is in charge of controlling the gaming time, sending data to server, loading the graphic and sound assets. The five games are so similar, that we've tried to build them with as much common code as possible.

We decided that we'll have a swf ( dispositionMotor )where the world is initialized, and that will load another swf ( nameOfGame.swf ), where the scenario and the game rules are contained. There will we only one "dispositionMotor" and five different "nameOfGame".

Right. So, now, there are two possibilities: first, we could have five different "world" classes, each one initializing the correct scenario, or we could try to have just one general "world" that could initialize different scenarios ( this one, this one!! )

Well, our world will have this line of code ( apart from another 400 ):

var controller: deIScenarioController = mcTimeline.getController( newMCContainer ); controller.initScenario( ); this.theScenario = controller.getInterface( );

Where mcTimeline is the timeline where the scenario swf is loaded.

In the first frame of the scenario swf, we have the following code:

this.getController = function( arg: MovieClip ) { //Instantiates de scenario controller but returns an interface var myController: cwScenarioController = new cwScenarioController( arg ); return deIScenarioController( myController ); }

The class cwScenarioController looks like

class Code.Ents.cwScenarioController extends ClipController implements deIScenarioController { private var theScenario: cwScenario; private var theClip: MovieClip; function cwScenarioController( clipParam: MovieClip ) { super( clipParam ); this.theClip = clipParam.movieClip; //this.theScenario.initLists( ); } public function initScenario( param: Object ) { this.theScenario = new cwScenario( ); this.theScenario.parentClip = this.theClip; this.theScenario.initLists( param ); } public function getInterface( ): deIScenario { return deIScenario( this.theScenario ); } }

The interface dIScenarioController code:

interface Code.Ents.deIScenarioController { public function initScenario( param: Object ); public function getInterface( ): deIScenario; }

So, now we have a reference to the controller methods in our world class, not to the controller itself, so we don't mind what the controller class does. We have a reference to methods like initScenario, but we don't mind about its implementation

And the method getInterface( ) of the class cwScenarioController returns another interface, which the world uses to communicate with the different scenarios.

A long post, but after a 13 hours coding sessions, it's been really relaxing..

May 15, 2004

OT- Free php5 hosting at dotgeek.org

My brother Javier sent me this link today. It seems that dotgeek is offering free php5 hosting.

I've applied for an account, and now I've got one!! ( it's not active yet, but here's the link: http://ctarda.dotgeek.org.

They offer php5, PostgreSQL, an ftp account, an email address...

You can apply here

May 09, 2004

OT- My gadgets collection grows.

I finally did it! Last friday I finally purchased a PocketPC ( HP iPaq2210 ). Here are the two youngest members of the design-nation family: ( from left to right ) PACO and PAVA.


Except two hang-ups ( the mix of Windows and me is, to say the least, dangerous ), it's working like a charm. The initial set up was easy and quick, including an update of the device ROM.

I've had a few ideas about some applications, I hope to find the time to develop them too.

By the way, I'd appreciate any link, comments about applications, whatever...

May 03, 2004

Accordion component

This is a simple example of how the accordion component can contain other components. In fact it's the source code of the accordion implemented in this blog's homepage.

Here´s the final result:

It has three tabs, the first one contains a list component, the second one contains a tree component, and the third one contains a single movieclip

So, first of all, you have to drag an instance of the list component and an instance of the tree component to the stage, and after that, delete them both, so they are included in the lybrary

I've also placed on the stage an instance of the accordion component, and I've setted its width and height, and setted its instance name to "accordion" ( without the quotes ). Don't delete the accordion instance.

I've also created a movieclip that contains the contact information. It's linkage name is "contact" ( without the quotes )

I also want both the downloads and link sections to load its own data from XML files, so everything will be easier to maintain and update. So, you can see the downloads_en.xml here.

You can review the tree_en.xml file here

So, the actionscript code will load both the "downloads_en.xml" file and the "tree_en.xml" file and, when loaded, will set the dataproviders of the list and the tree:

import mx.controls.Tree; import mx.controls.List; //var language: String = "es"; _global.style.setStyle("fontFamily", "TrebuchetMS" ); _global.style.setStyle("fontSize", 12); _global.style.setStyle("themeColor", "haloOrange"); var ac = this.accordion; ac.createChild( List, "downloadsF", { label: "Downloads", _width: 200, _height: 236 } ); ac.createChild( Tree, "linksF", { label: "Links", _width: 200, _height: 236 } ); ac.createChild( "contact", "contactF", { label: "Contact" } ); var myList = ac.getChildAt( 0 ); myList.vScrollPolicy = "auto"; myList.dataProvider = [ { label: "loading data", data: 0 } ]; myListXML = new XML( ); myListXML.ignoreWhite = true; myListXML[ "theList" ] = myList; myListXML.onLoad = function( success ) { if ( success ) { var theDP: Array = new Array( ); var elements: Array = this.firstChild.childNodes; var numElem: Number = elements.length; for ( var k: Number= 0; k< numElem; k++ ) { theDP.addItem( { label: elements[ k ].attributes[ "label" ], data: elements[ k ].attributes[ "data" ] } ); } this[ "theList" ].dataProvider = theDP; } } if ( language=="es" ) { myListXML.load( "http://www.design-nation.net/enlaces/downloads.xml" ); } else { myListXML.load( "http://www.design-nation.net/enlaces/downloads_en.xml" ); } var myTree = accordion.getChildAt( 1 ); myTree.vScrollPolicy = "auto"; myTree.setStyle("openEasing", mx.transitions.easing.Back.easeInOut ); myTreeDataProvider = new XML(); myTreeDataProvider.ignoreWhite = true; if (language=="es"){ myTreeDataProvider.load("http://www.design-nation.net/enlaces/tree.xml?ran="+ Math.random()); }else{ myTreeDataProvider.load("http://www.design-nation.net/enlaces/tree_en.xml?ran=" + Math.random()); } myTreeDataProvider.onLoad = function(){ myTree.dataProvider = this; } eventListener = new Object(); eventListener[ "tree" ] = myTree; eventListener[ "list" ] = myList; eventListener.change = function(eventObject){ if ( eventObject.target._name == "linksF" ) { var theSelectedNode = eventObject.target.selectedNode; var theSelectedNodeLabel = theSelectedNode.attributes.label; var esLink = theSelectedNode.attributes.isLink; var esBranch = this.tree.getIsBranch( theSelectedNode ) if ( esBranch ){ if ( this.tree.getIsOpen( theSelectedNode ) ){ this.tree.setIsOpen( theSelectedNode, false, true ); }else{ this.tree.setIsOpen( theSelectedNode, true, true ); } }else{ if ( esLink ){ var theSelectedNodeURL = theSelectedNode.attributes.url; getURL( theSelectedNodeURL ); } } } if ( eventObject.target._name == "downloadsF" ) { getURL( myList.selectedItem.data ); } } myTree.addEventListener("change", eventListener); myList.addEventListener( "change", eventListener );

And that's all.


May 01, 2004

Atom feed added

Here's the url: http://www.design-nation.net/en/atom.xml

If this is the syndication format of the future, well, we are ready now!