Forums / Developer / XML Driven Flash

XML Driven Flash

Author Message

Anaya P

Tuesday 25 May 2010 8:24:01 am

Hi

I am trying to integrate flash in a template file which is xml driven. Path to xml file is mentioned in actionscript.

I have created a class which has an attribute of type File where xml file will get uploaded in admin interface. I want that file to get uploaded at the same location everytime and by the same name. So I can specify that path in actionscript and do not need to change that everytime file gets uploaded.

Is it possible to upload file at same location and by the same name or is there any other better way to do this?

Thanks in advance for your help.

Regards

Matthieu Sévère

Tuesday 25 May 2010 8:35:15 am

Hello,

You really should use flashVars and give your file path through them in the template.

(the name of uploaded file will change for every upload)

--
eZ certified developer: http://ez.no/certification/verify/346216

Anaya P

Wednesday 26 May 2010 7:29:59 am

Thanks for your quick reply.

As you suggested I have tried to pass flashvars through html to swf file. But it is not working properly.

I am not flash expert, so may be have missed any step.

I have followed below steps -

1. created a variable of type string

2. in html passed value as a name of xml file.

In flash actionscript have below code -

function loadXML(loaded) {
if (loaded) {
_root.booth = this.firstChild.childNodes[62].childNodes[0].firstChild.nodeValue;
_root.area = this.firstChild.childNodes[62].childNodes[1].firstChild.nodeValue;
_root.price = this.firstChild.childNodes[62].childNodes[2].firstChild.nodeValue;
_root.company = this.firstChild.childNodes[62].childNodes[3].firstChild.nodeValue;
_root.website = this.firstChild.childNodes[62].childNodes[4].firstChild.nodeValue;
booth_txt.text = _root.booth;
area_txt.text = _root.area;
price_txt.text = _root.price;
company_txt.text = _root.company;
website_txt.text = _root.website;
} else {
trace(" file not loaded! " );
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(" myFlashVar " ) ;

value to myFlashVar is passed using flashvars syntax in html embed and object tag.

Can you please let me know what wrong i am doing here.

Regards