PDA

View Full Version : flash & xml database


flashmani
09-01-2004, 11:22 AM
Here is the link what i am doing....

http://flashmani.idohost.com/XMLFlashnew.html

My prob is i can't refersh the browser after adding or deleting the data.

Instead of delete button i need check box. after checking we can delete.

i want a edit button to edit also.

and the xml is used as database. for xml file saving i am using php...

any idea....

Flashmani

emergency_pants
09-01-2004, 12:28 PM
Do you need to refresh the browser?

What method are you using to import your xml data from the server?

Are you creating an XML object and loading data into it? Maybe you're using a component? I would use an xml object.

var myXML:XML = new XML();


Once you have imported your data into the xml object, you can determine the number of entries/rows and do stuff with the data. there's a lot of info in the flash help under "xml class".

I like to see the XML object a little bit like an array. You can add nodes, remove nodes, add child nodes, etc. You could even create an array from your XML object. Create a couple of functions which will add items and remove items from your array.

Inside your add itmes and remove items functions, you can place code which will shuffle your visual elements to match the changed xml object data.

You can create new objects for each element/item in your xml/array. That way you can track and manipulate it's data and visual vertical position.

var row1:Object = new Object();


Maybe there's no need to keep loading and saving stuff to a server all the time. You can manage everything in a flash session and then have a submit/save button which synchronises your flash movie with the server data.

Maybe that'll help. Its difficult to make many suggestions without any more detail. Good luck with it :)

flashmani
09-01-2004, 12:56 PM
Thanks emergency_pants for immediate reply

here my code. i am not a good coder. so i need correction and easy methods

can u....Help?


var m:Number;
var record:MovieClip;
var display:MovieClip;
var k:String;
var i:Number;
var user_xml:XML;
user_xml=new XML("<entry></entry>");
user_xml.ignoreWhite=true;
user_xml.contentType="text/xml"
user_xml.onLoad=function(success:Boolean)
{
if(success)
{


m=user_xml.firstChild.childNodes.length;
trace(m);
_root.createEmptyMovieClip("recordhold",0);
for(i=0;i<m;i++)
{
record=_root.recordhold.attachMovie("record","record"+i,i);
record.color_ = new Color(record.bck);
record._y=i*30;
record.txt_name.text=user_xml.firstChild.childNode s[i].attributes.usrname;
record.txt_age.text=user_xml.firstChild.childNodes[i].attributes.usrage;
record.txt_add.text=user_xml.firstChild.childNodes[i].attributes.usradd;
record.k=user_xml.firstChild.childNodes[i].attributes.image;
record.onRollOver=function()
{
this.color_.setRGB(0xCCCCCC);
display=attachMovie("display","display",100);
display._x=100;
display._y=_ymouse;
display.txt_name.text=this.txt_name.text;
display.txt_age.text=this.txt_age.text;
display.txt_add.text=this.txt_add.text;
display.pichold.loadMovie(this.k);

}
record.onRollOut=function()
{
this.color_.setRGB(0x99CCFF);
removeMovieClip(display);
}
record.onRelease=function()
{
var no=this._name;
var nn=no.substr(6);
trace(user_xml.firstChild.childNodes[nn]);
user_xml.firstChild.childNodes[nn].removeNode()
removeMovieClip(this);
removeMovieClip(display);
xmlsave();
}

}
//_root.myScroller.content=_root.recordhold;
_root.myScroller.setScrollContent(_root.recordhold );

}
else
{
trace("xml not found");
};

but.onRelease=function()
{
xmladd();

}

}
myIdentifier=Math.round(Math.random()*10000);
user_xml.load("data.xml?uniq="+myIdentifier);

function xmlsave()
{
var outXML:XML=new XML();
outXML.onLoad = onReply;

user_xml.sendAndLoad("xmlreader.php", outXML);

}

function xmladd()
{


user_xml.xmlDecl="<?xml version=\"1.0\" ?>"
inXML=user_xml.createElement("data");
inXML.attributes.usrname=input_name.text;
inXML.attributes.usrage=input_age.text;
inXML.attributes.usradd=input_add.text;
inXML.attributes.image="images/"+input_img.text;
user_xml.firstChild.appendChild(inXML);

input_name.text="";
input_age.text="";
input_add.text="";
input_img.text="";
xmlsave();

}

function xmldel()
{




}

flashmani
09-01-2004, 01:02 PM
one more question....

how can i add the mx2004 new scrollpane in this..i tried but.....

and i need checkbox thing like yahoo mail is there

and i am not using any data components..i am having std version mx2004


Please help me.....

flashmani
09-02-2004, 12:15 PM
any ideas..... flashmaster guys...?

flashmani
09-04-2004, 08:19 AM
please its eating me...

anybody can help me here...

madgett
09-04-2004, 08:22 AM
Post your .FLA file and let us take a look.

flashmani
09-06-2004, 12:55 PM
Hai here is the file

httP://flashmani.idohost.com/XMLFlashnew.fla


Please....

Flashmani