Marty
Marty

Reputation: 39456

Can I use server-side technology to alter the value of a var in a SWF and then save a new version of that SWF?

Overview:

I have a SWF banner ad template which loads in JSON from a platform that I have developed and then cycles through some products that were specified in that JSON. Each product is made up of your standard title, price and image.

On the platform, the user has the ability to modify the JSON feed via some UI tools such as image upload, title change etc.

Once they've done this, they can save and preview the ad. The preview is a SWF file embedded on the current page with some FlashVars that reference the location of the JSON they just created.

The request:

The user wants the ability to be able to archive all versions that they have created locally (as SWFs on their drive).

I offered a few solutions such as:

Unfortunately, they are pushing to have a single SWF downloaded which they can save as an encapsulated file. The idea is that this eliminates an abundance of files down the track, as well as the ability to place components in the wrong directories, etc.

Question:

I need to use PHP (if possible) to do the following:

  1. Create a copy of the SWF template.
  2. Alter the value of the variable inside the copied SWF containing the URL to the appropriate archived JSON URL.
  3. Save that version and then begin downloading it.

Is this possible? If so, how?

Upvotes: 2

Views: 127

Answers (1)

Jason Sturges
Jason Sturges

Reputation: 15955

I've heard of companies using the mxmlc compiler to encapsulate a monolithic build creating custom SWFs server-side.

This has been leveraged to build SWFs on the fly which would otherwise require heavy loading of resources.

The approach:

  1. PHP script would alter an ActionScript file, setting variables and [Embed] resources.

  2. PHP script would call mxmlc command line compiler to build the SWF, essentially the same as Flash Builder would compile a pure ActionScript project.

Perhaps an ANT task could automate the build.

References:

Upvotes: 3

Related Questions