The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> Flash Help
|
ActionScript 3 - Running flash on a web server
Discuss Running flash on a web server in the Flash Help forum on Dev Shed. Running flash on a web server Flash Help forum discussing all products originally created by Macromedia including DreamWeaver, Contribute, Flash, Fireworks, Freehand, Director, Authorware and HomeSite. Adobe bought Macromedia in 2005.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 5th, 2011, 02:59 AM
|
 |
/*
|
|
Join Date: Mar 2007
Location: Sydney, Australia
|
|
|
ActionScript 3 - Running flash on a web server
Hi folks,
I work on a lot of digital media projects; which often require dynamic graphics. I find flash to be a great tool for this purpose. It's very easily to dynamically change text inside a swf, compensate for text overflow and apply lots of nice filters and effects. Not to mention font embedding.
This technique works great for web pages, however quite often we want to use flash generated artwork in a html email. How can we do this? Well, we can use as3corelib to generate a jpg from a swf, and then use the generated image in an email.
This is fine, so long as we can pre-generate all of the images, before sending out the emails. But say we need to generate the dynamic jpeg on the fly from a webpage? If the user on the webpage has flash installed we could configure a swf to generate the image for us.
But what if the user has flash disabled? Maybe they are using an ios device or simply don't like flash.
What I would like to do is set up a server side fallback that could run a swf, replace text in the swf based on supplied variables, generate a jpg using as3corelib and save the jpeg somewhere. The trick here is running flash player on the server. It would also need to run in a multithreaded way in case the server needed to process multiple requests.
Anyone have any ideas? I appreciate any comments.
__________________
*/
|

March 5th, 2011, 04:38 PM
|
|
Gotta get to the next screen..
|
|
Join Date: Nov 2003
Location: Legion of Dynamic Discord
|
|
|
Howdy, you can try using Flash and PHPs GD image library. Just google all of those for some relevant tutorials. The gist of the idea is that you use Flash to make a screenshot of itself which it then sends to PHP that then uses the GD library to save a still image file i.e. jpg.
The downside is that someone has to run the SWF for the image to be saved. Also, you don't want it to save a new image each time anyone views the SWF. What might work nicely is if you made your normal Flash version as you have now. Then make a new SWF that has the screenshot code and PHP talking code in it. That would do three things. (1) Load in your current SWF content file (2) Take a screenshot of it (3) Send that data PHP so it can be saved.
So then when you want people to see the Flash version you just point their browsers towards the normal content clip but when you want to update the static image version then you yourself can manually run the screenshot taking SWF.
You could look into using a Cron job on Linux or a Task (Task Scheduler) on Windows. That would let you automate running the screenshot taking SWF.
I've never done this process before, I just made it up but it sounds like it could work. At least it gives you something to tinker with. You might want to have a look at the PHP Ming library. It sounds kinda basic on its own but you could integrate it with other SWFs that you made in the IDE with more advanced features and functionality that you could not implement with Ming.
__________________
Quis custodiet ipsos custodes?
|

March 5th, 2011, 05:25 PM
|
 |
/*
|
|
Join Date: Mar 2007
Location: Sydney, Australia
|
|
Hi Tan,
Thanks for your thoughts and comments. I like the idea of using a cron job or scheduled task. I've had a look into AIR 2 and have found that it can act as a socket server.
I'm thinking of a process similar to this:
If a website user does not have flash I can not load a swf in their session to generate the screenshot.
In this case I could capture the relevant data in a web form and store it in a db.
A cron job on the server could poll the database regularly.
If new data is found the cron job could send the information to a running air app via a socket connection.
The AIR app could then generate the jpg and save it in an appropriate location.
It would be interesting to test this. Too be honest I'm leaning towards either using a static generic image for use cases where the user hasn't got flash installed or presenting them with a message to say that flash needs to be installed in order to use the service.
|

March 6th, 2011, 03:29 AM
|
|
Gotta get to the next screen..
|
|
Join Date: Nov 2003
Location: Legion of Dynamic Discord
|
|
|
Going with a single default static image would make the whole thing a lot simpler. I use swfobject2 for embedding my SWFs into the HTML pages. That lets you serve up alternative content if they do not have Flash installed. I normally use a static still image, a pure HTML alternative or sometimes just a "Get Flash" link. Depends on what the content it/how lazy I am/how long I have to spend on it.
Haven't touched Air 2 yet, last time I used it was v1 or v1.1 something like that. I'd be very interested to hear about your progress if you do decide to implement an Air socket server. If it's simple then I would totally make one for some pet projects I have written down. Couldn't be arsed with Red5 or the developer edition of Flash Media Server.
|

March 12th, 2011, 07:33 AM
|
 |
/*
|
|
Join Date: Mar 2007
Location: Sydney, Australia
|
|
|
I will post back if / when I experiment with an AIR socket server.
|

November 26th, 2012, 08:45 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 2 m 15 sec
Reputation Power: 0
|
|
|
any luck
Hi Benno,
Did you get this working?
Thanks
|

November 27th, 2012, 02:16 AM
|
 |
/*
|
|
Join Date: Mar 2007
Location: Sydney, Australia
|
|
Quote: | Originally Posted by doogma Hi Benno,
Did you get this working?
Thanks |
Hi Doogma,
Sad to say that I did not persue this project any further. I'd still like to try this but have been moving away from flash ever since Adobe stopped supporting it for mobile devices and abandoned Flex.
regards
Ben
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|