views:

102

answers:

3

Hi I have a flash movie with a button to 'view items in new browser window.'

These items are all dynamically generated in flash. So the html has to be dynamically generated as well.

Can any sugest a way to do this? Do I need to use php or some server side script?

A: 

It's probably a bad practice to generate it all from within flash. I reckon the most common solution would be to pass only the generated data to a server script or js method that replicates the way items shows up in flash but in HTML for instance.

Theo.T
Be careful with passing content to the server and getting the server to execute it! This can easily be used by evil doers (code injection).
TandemAdam
Definitely, that's why i would only pass pure data so the remote method could moderate it. Generating the whole content from within flash would just be a big security hole since the remote would be forced to publish it blindely. Good point to emphasize though!
Theo.T
A: 

if you mean "in new browser window." , then all you need to do is something like

navigateToURL(new URLRequest("http://www.yoursite.com/somePage.php?content=hi_there"), "_blank");

where the http://www.yoursite.com/somePage.php contains dynamically generated content from the querystring ( say... retrieve the content "hi there" from the example above) using PHP/server side script

if you mean "html content generated INSIDE flash", then you can use FlashML http://osflash.org/flashml (seems to be actionscript 2 tho )

if you mean "html like content in Flash", then you can write script to form your own content inside flash, like dynamically putting movieclips together to make it like a html page

Unreality
A: 

Use a hybrid of Javascript AND Flash. So Flash triggers the function for the Javascript to do the DOM/HTML manipulation.

In flash you will call the External library to pass some essential parameters to the JS.

it goes like this in AS3:

import flash.external.*;
...
ExternalInterface.call("JavascriptFunctionName", escape(param1), escape(param2));

In JavaScript:

JavascriptFunctionName = function(_param1, _param2){
 CreateHTMLElement(unescape(_param1));
 CreateMenuItem(unescape(_param2));
}

If you are passing a lot of data, I'd suggest using a php proxy/webservice.

JONYC