Archive for June, 2006

Flash-XML [ Part 2]

June 22, 2006

Hi,I hope you have already gone through part1 of this tutorial. Then you might have come across a lot many things, which seemed alien to you.No problem, thats the first experience I also had, when I started XML. The problem here is, we doubt the simpplicity of XML. Its not that complex as we think.
Here we are going to learn the steps involved in XML-Flash communication.To get the XML data inside Flash or any other environment, we need an engine, which actually converts XML data into our native environment data(In our case the Flash data). This is the engine proffessionals call "Parser". We can create our own engine or parser too.But lets take the parser provided by "Flash" itself. What this parser does is, it converts XML data into "Flash" data. That means Flash already has got an object known as "XML". We will use this object to get the external xml data inside Flash.After getting the external data into flash's XML object, we will access those data through some methods provided by Flash's XML object.So all we have to do is, know the methods to get data inside flash and access them.

(more…)

Flash-XML [ part1 ]

June 8, 2006

Hi,
Here we will learn how to make flash movie, which can communicate with XML data. I am not going to delve into the details of XML here. But quickly go through the process of getting data from XML into Flash.

First we must understand XML, though not thoroughly, but atleast the basics. XML is a data storing language.Its not like HTML, which is a presentaion language. So basically XML files store some data.Thats more than enough for this lesson.we can write xml files by simply opening our notepad and typing in the tags.then saving the file with ".xml" extension. we can save the file with ".txt" extension too.But then we have to rename it, so that the extension will be ".xml". Now, how it stores the data? Well it stores all the datas in the form of "Elements" or "Nodes". Whats that ?!! That is,
<name>my name</name>
This is a basic exmple of a xml node. we start a node by a start tag say "<node>", and end the tag with a end tag of same name "</node>".So a node is like
<me></me>
The above thing is a node which contains no data. See the name of teh node is not important, unlike HTML where we have pre defined tag names.So we can create any node with any name.Though there is also a naming convention, which should be used, and there are certain rules to name a node, but for our understanding here and to keep things simple at first go we will not delve into the details of those right now.Just understand that to name a node, it should consist of alphabets only.So we can create nodes like the following
<name></name>
<value></value>
<age></age>

Now, where to put data.We data is stored inside the start tag and end tag of nodes.So lets put some value in our nodes.
<name>my name</name>
<value>555</value>

Thats great. Now lets say we want to put a person's data.And in the long run, I have to go on putting different people's data in my XML to create my XML addressbook.Ok, Now we will create kind of datas inside datas.Simply I can put nodes inside nodes. As I put some value inside my nodes, I can put nodes also, instead of values, like
<me><name>saumya</name><no>678</no></me>
See, I have put nodes inside nodes.To better understand we generally write this as
<me>
<name>saumya</name>
<no>678</no>
</me>
Makes sense? yeah. "me" node contains all the datas regarding me. Now to make it generalised, I thought, "me" should be changed to "person".So that I can put any body's data.well, now the XML will look like
<person>
<name>saumya</name>
<no>678</no>
</person>
(more…)