Hi,
How can i pass an xml file from python to flex 3..? Any one can help me...... with example code

Recommended Answers

All 5 Replies

Please give us some details on what flex 3 is.

What do you meant by "what flex 3 is."? Sorry for such a simple question ........ I am new to Python and Flex also.


I want to connect flex and python........ I was send the data from flex to python successfully..... now I want to send an xml file to flex application from python...

But what exactly is "Flex 3"? Thats what we are asking.. Links?

Adobe Flex 3 is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems.


http://www.adobe.com/products/flex/

I want the code for sending an xml file from python

Basically, he's talking about passing an .xml file from python to a flash application.

The OP could take a look at this link:
http://www.swaroopch.com/blog/big-brother/

Here, the author has created a python script to monitor a users pc usage, logging the details of time spent in different applications and writing the details out to a text file.
He's then created a flash file (using flex) to read the text file and output a graph of the users time spent in different applications.

And that's about as simple as you can get. Run the python script to generate a text file and then use the flash file to open the text file and read the data from it. (Or in the OP's case an xml file rather than a text file)

In fact I've done something vaguely similar, I created a flash based clock application to sit on my active desktop which counts down how long I have left until I can go home. Each morning when I first start up my work pc, a C++ program I wrote is fired up which asks me what time I clocked in. Optionally I can let it know how many hours I want to work that day, otherwise it defaults to my standard contractually obliged amount (8 hours and 18 minutes including lunch, I'm on flexi-time, so that's how many hours I have to average per day).

The C++ program then creates an xml file which is read by the flash clock application on the active desktop informing it of what time I intend to leave for home. All I do then is refresh my desktop, the flash clock is reloaded (causing it to read the latest version of the xml file) and I can see how much longer I need to work for!

I also created another C++ program which allows me to specify a time to leave (I'm on flexi time, plus sometimes there are appointments to keep) this also overwrites the xml file. After running this, I simply refresh my desktop and I can see how long until I need to leave.

OK, so I used C++ generated .exe's to create my xml file, but I could just as easily have used a Python script to do it!

So in nimmyliji's case it should just be a case of writing a script to create an xml file and then creating flash file to load and parse the xml file. At the very simplest level anyway!

If he wants to pass the xml file directly to the flash application, that's a different kettle of fish altogether.

I suppose in that case it should be possible to create a python script that will generate the .xml file and then fire up an instance of flashplayer as a process/thread, passing the path/name of the .swf as a parameter to flashplayer and also passing the path to the .xml file as a parameter to the .swf (using flashvars).

That way the script in the swf will use the passed in path to find and load the xml file and do whatever it needs to do with the data.

I've never done this, but I suppose it should be possible.
But I'm not aware of any way to pass the xml file from python to an already running flash application.
Perhaps if the flash file periodically reloaded the xml file, that might be another way around it.

If the OP could give more details about exactly what he wants, it may clear things up a bit!

BTW, I've attached a screenshot of my desktop at work. The left side of the pic shows my left monitor, with the countdown running at the top.
(There's also my desktop notepad, another little flash app on the active desktop.)
The right side of the image shows the two C++ programs running in my right monitor. They only run once and even then I only ever run one of them and they don't stay running all day or anything, I've just shown both running for illustrative purposes!

Cheers for now,
Jas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.