PDA

View Full Version : Using externalInterface during development



Rick Banghart
November 20th, 2007, 07:58 PM
I'm writing a Flash application that reads context information through a bunch of calls to externalInterface. I have been hardcoding the values during development, then commenting those lines out when I publish.

Is there a way to simulate the javascript functions (that return the values) in the development environment so I can develop and deploy the same code?

Thanks

Dazzer
November 20th, 2007, 11:01 PM
If I think I know what you're saying:

Draw up a 2nd layer of abstraction (say, JavascriptInterface) and program through that.

Inside JavascriptInterface return the values which should be returned.

Once your program works, then put ExternalInterface inside JavascriptInterface. So now ExternalInterface will pass values to whatever was calling the JavascriptInterface.

That would be my suggestion. Other than that, I don't believe there is a way to simulate javascript functions in the development environment.

quietless
November 20th, 2007, 11:55 PM
I'm writing a Flash application that reads context information through a bunch of calls to externalInterface. I have been hardcoding the values during development, then commenting those lines out when I publish.

Is there a way to simulate the javascript functions (that return the values) in the development environment so I can develop and deploy the same code?

Thanks


Yes your question is vague. It sounds like you are trying to set up a dev environment to sidestep the security sandbox that won't allow you to test ExternalInterface locally. To do that the best solution is to install and run MAMP which will allow you to test your application locally via the browser through "localhost:8888"

hth
-stephen

Rick Banghart
November 21st, 2007, 02:15 PM
Yes your question is vague. It sounds like you are trying to set up a dev environment to sidestep the security sandbox that won't allow you to test ExternalInterface locally. To do that the best solution is to install and run MAMP which will allow you to test your application locally via the browser through "localhost:8888"

hth
-stephen

Let's see if I can make my question more clear. When my Flash application is published and delivered from my web server, the surrounding html contains javascript functions that are called by externalInterface. These functions pass context information that sets up the initial state of the Flash application. When I test the movie in the development environment there are no html or javascript functions to pass the context information. (Specifically, I pass the directory necessary to load subsequent XML and video files.)

So far, I have been hard coding that directory information during development, then commenting those lines out before publishing. I was hoping there was a way to avoid that step before publishing.

Please let me know if that makes things less vague.

Thanks

Rick Banghart
November 21st, 2007, 02:28 PM
Yes your question is vague. It sounds like you are trying to set up a dev environment to sidestep the security sandbox that won't allow you to test ExternalInterface locally. To do that the best solution is to install and run MAMP which will allow you to test your application locally via the browser through "localhost:8888"

hth
-stephen

A couple of things that stand in the way of my using MAMP:

1. I develop using Windows.
2. I don't think MAMP would solve the problem. Using MAMP I would lose the easy debugging of the development environment.

Thanks for the reply

Dazzer
November 21st, 2007, 11:10 PM
Well then I would suggest using a test harness (like I suggested above).