Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Program communicating with the website's flash

Program communicating with the website's flash
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2007
Status: Offline
Reply With Quote
Nov 28, 2007, 11:55 PM
 
Hi All,

I want to write a C++ program which will communicate with the website's flash .swf file. I am using MAC OS X 10.4 & Carbon framework for the developement.
As flash in the website is server side & C++ is client side, I am not getting exact idea about where to start with it & how to accomplish it. Shall I use dynamic library(.dylib) stuff for it to complete. I want to catch events takes place in the .swf on the website.

There may be many options but which will be the best & supporting on MAC OS X 10.4

Help is appreciated.

Thanks
Ulhas
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 12:27 AM
 
Flash is a closed and proprietary system, but it apparently can pass data to some sort of Flash server. I have not looked into this though, but you can count on this costing money...

Flash will also allow you to pass variables in and out of it using HTTP GET. This is probably the most straight forward way to exchange data with Flash movies (this is what I do on my sites). Flash support URL encoding to properly escape characters that would mess up query strings (i.e. ? and &

Does this help?
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 01:10 AM
 
Originally Posted by iKernel View Post
Hi All,
I want to write a C++ program which will communicate with the website's flash .swf file. I am using MAC OS X 10.4 & Carbon framework for the developement.
As flash in the website is server side & C++ is client side, I am not getting exact idea about where to start with it & how to accomplish it. Shall I use dynamic library(.dylib) stuff for it to complete. I want to catch events takes place in the .swf on the website.
I'm not really understanding what you're trying to do... but I think your premise that Flash is somehow running on the server is incorrect. Flash movies are always running locally, most commonly in a plugin within a browser: they aren't executables on the server at all, they just reside there as files to be downloaded into the browser where the Flash movies are actually playing.

Those Flash movies can communicate information about their state by POSTing (or GETting) to a URL on a server - typically (but not always) the server where the movie was downloaded from. Flash movies can even open socket connections with the server. But they can't and don't communicate with other code executing on the client, with the exception of some limited communication that takes place with the browser itself.

It should be possible for Flash movies to communicate state information to the web server... and have that polled by a C++ script running locally, but there are other issues implied by such a model, like how you'd be able to track a particular instance of a Flash movie you're monitoring - if that's an important design criteria.

But a web-based Flash movie won't have access to local executables (apart from the browser) or local files on the client. There are ways of using FSCommand to have Flash communicate with local applications (essentially by running 'exec') , but only if you're running a stand-alone Flash Projector from your local file system.
     
iKernel  (op)
Fresh-Faced Recruit
Join Date: Nov 2007
Status: Offline
Reply With Quote
Nov 29, 2007, 01:55 AM
 
I explored about the FSCommand also but is that the option to communicate with the local app from flash using exec? Can I use Local connection API of flash(embeded in C++ stand alone app) to communicate with flash of web site. If it is possible to communicate with stand-alone Flash Projector using exec & FSCommand then once I done this I can use Local Connectiopn API to communicate between flash(stand alone app)-flash(website).
Is this FScommand supports in MAC OS X 10.4?
Thanks in advance.

Regards
Ulhas
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 02:09 AM
 
Since I have no idea what you're trying to do, I can't really help you... but for the most part, there are security issues in having locally executable Flash movies communicating with Flash movies loaded remotely and vice-versa.
     
iKernel  (op)
Fresh-Faced Recruit
Join Date: Nov 2007
Status: Offline
Reply With Quote
Nov 29, 2007, 03:01 AM
 
let me explain in brief...
I have a website which has flash GUI. In that flash GUI drag & drop events will occure & I want to catch these events in my C++ stand alone app & want to do changes accordingly. I found a lot of stuff searching over the net like FSCommand, ExternalInterface, dynamic library etc. But I am not getting exact idea about what to use & how to use it?
please guide me to the right way.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 09:10 AM
 
Originally Posted by iKernel View Post
let me explain in brief...
I have a website which has flash GUI. In that flash GUI drag & drop events will occure & I want to catch these events in my C++ stand alone app & want to do changes accordingly. I found a lot of stuff searching over the net like FSCommand, ExternalInterface, dynamic library etc. But I am not getting exact idea about what to use & how to use it?
please guide me to the right way.
This is probably tangential and there is probably a good reason that I haven't accounted for, but this does sound like something that would be much easier treated as an AJAX call, although I'm not understanding what role your C++ client app would play... Would it also run on the server? What data is it collecting?

It is very odd for a website to communicate directly to a client app like this. Wouldn't it make more sense for the web app to write to a file or database, and the C++ app simply read from this data source?
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 09:17 AM
 
Originally Posted by iKernel View Post
let me explain in brief...
I have a website which has flash GUI. In that flash GUI drag & drop events will occure & I want to catch these events in my C++ stand alone app & want to do changes accordingly. I found a lot of stuff searching over the net like FSCommand, ExternalInterface, dynamic library etc. But I am not getting exact idea about what to use & how to use it?
please guide me to the right way.
I don't think you're going to find APIs that allow a Flash movie running in a browser to interact with a local executable because of the incredible amount of mischief that could result from that.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 09:21 AM
 
Originally Posted by eggman View Post
I don't think you're going to find APIs that allow a Flash movie running in a browser to interact with a local executable because of the incredible amount of mischief that could result from that.
Although his local executable could periodically pull information out of a logfile, right?
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 10:08 AM
 
Originally Posted by besson3c View Post
Although his local executable could periodically pull information out of a logfile, right?
Yes... but it's a pretty circuitous ride, and one that's not going to be terribly interactive.

A drag-and-drop event happens in the Flash movie which calls a script on the server that posts the event to a log on the server... which is polled at regular intervals from the C++ program? That means ongoing hits to the server from the C++ program on an ongoing basis whenever it's running... unless its using some kind of socket connection.

More to the point, how do the Flash movie and the C++ program do the handshaking necessary to establish the identity of the instance of the Flash movie running on the client so that the C++ program knows which events are the local ones it wants to track? I don't see how you get around that one.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 10:26 AM
 
Originally Posted by eggman View Post
Yes... but it's a pretty circuitous ride, and one that's not going to be terribly interactive.

A drag-and-drop event happens in the Flash movie which calls a script on the server that posts the event to a log on the server... which is polled at regular intervals from the C++ program? That means ongoing hits to the server from the C++ program on an ongoing basis whenever it's running... unless its using some kind of socket connection.
Well, if by ongoing hits you mean web server hits, I was thinking about doing this more at the filesystem level...

More to the point, how do the Flash movie and the C++ program do the handshaking necessary to establish the identity of the instance of the Flash movie running on the client so that the C++ program knows which events are the local ones it wants to track? I don't see how you get around that one.
Well, we could make this even more of a circuitous ride by bringing something like Perl or PHP into the picture, writing an md5 hash to the log file associated with the IP, and using the hash as a sort of challenge/response type form of authentication.

I'm still not sure I understand how all the pieces would fit together though. In short, if I were the original poster, I would rethink this entire design...
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 11:37 AM
 
Originally Posted by besson3c View Post
Well, if by ongoing hits you mean web server hits, I was thinking about doing this more at the filesystem level...
...
I'm still not sure I understand how all the pieces would fit together though. In short, if I were the original poster, I would rethink this entire design...
Flash doesn't have access to the file system.

But I agree with you about the OP rethinking this entire design. It doesn't seem practicable.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 11:41 AM
 
Originally Posted by eggman View Post
Flash doesn't have access to the file system.
I don't think this is right... You can load movie clips and sounds and stuff by referring to the files as files, not URLs.


Edit: unless these file requests are negotiated by the web server? I guess a test would be to try to read a file outside of the web server's document root.
     
Mac Enthusiast
Join Date: Aug 2002
Location: Santa Rosa, CA
Status: Offline
Reply With Quote
Nov 29, 2007, 12:32 PM
 
Originally Posted by besson3c View Post
I don't think this is right... You can load movie clips and sounds and stuff by referring to the files as files, not URLs.


Edit: unless these file requests are negotiated by the web server? I guess a test would be to try to read a file outside of the web server's document root.
You can't read local file system files from an .SWF movie downloaded from a website... but if you're running a movie from Flash or a Flash Projector file you can access the file system.

The OP was specifying an .SWF on a web server.

The Flash security model isn't trivial to wrap one's brain around, but it's described in exquisite detail here.

But the upshot is this - if a Flash file embedded in a page from some arbitrary website were able to read local files, then that would be a serious security hole.

Think for a minute about going to a website that contains what is to all appearances merely a Flash ad... but which is actually an application capable of reading local data from your hard drive and reporting it back to the server.

There's a name for something like that: spyware.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 29, 2007, 12:37 PM
 
Ahhh.... I see what you mean now. I was thinking you meant local as in local to that *server*, not local to the computer/visitor playing the Flash movie. Yeah, reading local files would be an insanely bad idea.
     
iKernel  (op)
Fresh-Faced Recruit
Join Date: Nov 2007
Status: Offline
Reply With Quote
Dec 1, 2007, 06:07 AM
 
I got there is one more option to do it. That is use one local swf embedded in the web page which will further embedded in C++ program using Web Kit framework as given here
Web Kit Objective-C Programming Guide: Accessing the Web Kit From Carbon Applications

Local connection API will help to communicate between two different .swf files on different domains as given here http://kb.adobe.com/selfservice/view...nalId=tn_16243

After accomplishing this I will try to communicate between C++ & .SWF through JavaScript which is possible using the library WITTY here http://www.webtoolkit.eu/wt/
I think I can do this.
please help further.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:35 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2