swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] wait for SWF to be ready


From: Benedikt Quirmbach
Subject: Re: [Swftools-common] wait for SWF to be ready
Date: Fri, 30 Jan 2009 12:19:20 +0100

Hi Ian,

thanks for the tipps!

(I'm sorry I mailed this to your private address... Here is the mail for the mailing list...)

I made some investigation, too.
Here ist what I found:

First of all: What does my program?
When my Flex-application needs a new SWF it sends a demand to the php- script. the php-script deletes all files that are related to a probably existing earlier version: SWFs and sc-files.
Than it creates a new SWF and sends the verbose-output of SWFC to Flex.
The Flex-application walts for that output and when receiving it deletes its own SWFLoader and creates it new and than loads the new SWF. When loading the SWF Flex extends the url with different parameters. One of them is a timestamp.

There are two different situations:
At first start of the Flex-application you have to open a php-page in the browser that contains the Flex-app and load all the contends from a server. When you do this, everything will be loaded correctly including the SWF in Flex.

Than you can make some changes and load the changed SWF again. In this case the php-page and the Flex-app are allready there. In this case you get a working SWF (animation and Picts), but with some variable data missing.

To create this SWF SWFC takes a library-SWF as background-image and a little peace of ActionScript for the variable data.
The Library-SWF has about 55 kb.

Now I have tried to make the same procedure with a very small library- SWF (less than 4 kb).
And now it works fine!

This success lets me think, that there must be a timing problem: It looks like the output from SWFC is coming bevore the SWF is really ready. I inserted a waiting loop into the Flex-application. After receiving the output-message from SWFC it waits 10(!!!) seconds bevore starting loading the SWF. But with no success loading the original SWFs!



What is going on here?
Benedikt


Am 29.01.2009 um 19:00 schrieb Ian Wilkinson:

Hi Benedikt,

Here are then my follow-up thoughts...

We have had big problems with web servers (IIS particularly) and web browsers (IE particularly) caching the files when you try to loadmovie in flashplayer. We instigated several techniques, first of all place a random number after the name of the movie that you're loading, eg:

loadmovie("movie.swf?rn="+Math.random(), mc)

Secondly configure the webserver to send the expires header and the (depreciated) PRAGMA: NO-CACHE.

If you can't do this I'd recommend making your php send the content of the movie back, using php to set the caching headers.

Ian


Benedikt Quirmbach wrote:

Hello Ian,
I'm sorry that I did not explain my goals!
I want to create SWFs that contain the variabe data by themselfs.
In fact it is a web-banner workbench where you can choose a banner template (my library swf) and "inject" your personal data. After creating this swf you can download it and use it as a banner where you want. Because you use it as a banner you can't work with url-parameters. It has to be one file and nothing else. I wrote a Flex application with some php scripts and a database in the background. The problem is not how to get the variable data into the banner template.
This works fine!
The problem is, that my Flex application seems to load the newly created swfs bevor they are completed. I don't know how this can be, but it is at this moment the only explanation for what I see: When the application loads the newly created swfs some variable data are missing. When I download the very same swf a little moment later, the data are included and the banner works fine. But if you want to create this banner, you want to have a working preview in the Flex application... Maybe there is someone who has allready created a banner workbench like I want. And maybe there are other ways to get the data into the swf. Ofcause I could create the swfs all in SWFC without a Flash template. But there is a lot of animation in the templates what makes it very difficult to write it in a .sc-file. And I don't know whether it fixes my problem or not...
Benedikt
Am 23.01.2009 um 20:17 schrieb Ian Wilkinson:
Benedikt Quirmbach wrote:

Hi,
some weeks ago I opened a thread here about swfc.
I am still looking for a way to find out wether a SWF is completed.
I have a swf (library-swf) made in Flash.
I want to bring some variables into this swf.
To do that I use SWFC to create a new swf with the library-swf as background image.
In the first frame i introduce an actionscript with my varaibles.
In the library-swf is more actionscript that use this variables.


Hi Benedikt,

I'm from a background of 8 years using Flash with CGI, where our software loads variables thousands of times a day (but please excuse me if I've missed the point of your post).

If all you need is to pass data to php and get it (or other data) back, then you don't need to use SWFC at all.

If you use either the loadvariables(mc,...) command or the loadvariables object you can send changes via GET or POST and have the PHP send back the what you need it to at the same time.

The first time in just call the loadvariables to load what you need and have the php only save what's required when you pass it back out.

Don't be concerned that most of the documentation around loadvariables mentions XML, we don't use any XML in our application as it wastes so much bandwidth (5KB of data we found would be 50KB+ in XML).
Use variable=value and just escape the value.

so a typical string could be:-
&productCount=3&price0=500.00&name0=Self%20Sealing %20Stembolts&price1=25.00&name1=American %20Screwdriver&price2=0.03&name2=Screw&end=1&


If you don't use the object you need to know when all the data is loaded the end=1 does that for you (just set end=0 before calling loadvariables then loop over a couple of frames until end=1), you can leave that out if you use the object, however you should always add an extra ampersand on the end of the string so flash doesn't pick up and stray spaces or enters that the php might output after the data.


Sorry if I've missed the point of your post, if I have then please don't hesitate to expand your requirements and I'll help if I can!

Ian.
--
x10 via Web or Wap?
http://www.sgtwilko.f9.co.uk/bluelava/


--
x10 via Web or Wap?
http://www.sgtwilko.f9.co.uk/bluelava/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]