Flash: Prevent images coming from cache? - actionscript-3

We created a simple Flash animation that reads from an XML file in another server. This XML file has tags with the path of several images that will be displayed in the Flash. The xml tag looks like this:
<image_name><![CDATA[assets/images/image1.jpg]]></image_name>
When I tested locally I realized that, even after I changed the image in the XML, the SWF was still showing the image from the browser cache. So the developer ended up adding some random function so that the cache would not be an issue. That fixed the issue.
Unfortunately, the webhost that will publish the SWF tells me that they can't upload the SWF because the system doesn't allow SWF files that use random functions. So I can remove it and resubmit, but then the problem with the cache will be there.
Is there another alternative?
Thanks.

Preventing caching at all isn't a good idea in general, it's very useful feature that safes server traffic and decrease swf loading time.
Some of the solutions here can be to change URL in the xml config by adding version of the image manually:
<image_name><![CDATA[assets/images/image1.jpg?image_v1]]></image_name>
or generate this version automatically with script as md5 of the image bytes:
<image_name><![CDATA[assets/images/image1.jpg?5d41402abc4b2a76b9719d911017c592]]></image_name>
but it's required much more setup work.
Or add the version of the swf application:
<image_name><![CDATA[assets/images/image1.jpg?app_v1]]></image_name>
the last solution is a compromise between two options - maintaining version of each image file and removing cache at all. In this case you have to maintain only the version of swf file, but you have to update it each time you change some of the images.

Preventing cache isn't good, but here is my solution: use a "random" number (current time in seconds) as a param assets/images/image1.jpg?t=RandomNumber.

Related

OBIEE 12C: HTML caching for downloadable file

I've made an analysis in OBIEE which searches for a file in the analyticsRes folder on the server.
The column formula looks like this : ''||"Afdeling"."Afdeling"||''
It downloads the correct file according to the filter you're applying on the dashboard. This works perfectly fine, except for browser cache.
We found out that the browser caches the file behind this link, so when a new one is put on the server, the old one still gets downloaded.
Can I disable browser cache for this analysis only OR for the whole dashboard (is this a good idea?) so that users will always download the newest version of the file?
I've tried adapting the instanceconfig.xml file according to this:
<ServerInstance>
<Cache>
<CatalogXml>
<!-- Remove from the cache everything older than N minutes -->
<MaxAgeMinutes>240</MaxAgeMinutes>
<MaxLastAccessedSeconds>14400</MaxLastAccessedSeconds> </CatalogXml>
</Cache> </ServerInstance>
But this isn't the cache used for my issue.
I expect the analysis to be able to always look on the server for the file, but now it caches the file for a long time. It would be also okay if the cache would expire after 24h.
Thanks!
No. You have zero influence on browser cache from inside OBIEE. The cache above is OBIPS cache, not browser cache.

mijovideos plugin is not uploading larger files 128MB and small

im using mijovideos as my joomla plugin for my videosharing component and it wont let me upload larger files(128mb) on the second option also the smaller videos like 80mb and below keep saying ERROR Processing mp4 file but the file is uploaded.enter image description here
As far as upload limits are concerned, you'll need to get into your php.ini file and edit the upload limit on that.
Locate your PHP.ini file
You can do that unless you're running off of GoDaddy servers, in which case your PHP.ini is inaccessible. So you'll need to create your own and put it in your site's base directory.
When it comes to video uploading, I'm unfamiliar with mijovideos. I would recommend using All Video Share to get the job done. It works well enough for my website, although you'll need to do quite a bit of tweaking to get it to fit your site's design and format. Which is true for any website / extension, I assume.

Pass file from AS3 into embedded AS2 wrapper to load

I have a Flash AS3 application that uses FileReference.browse() to request a SWF from the user. If the chosen SWF is AS3, I'm good to go. However, if it's AS2, I need to load it into an AS2 wrapper first (so my app can alter it). All of these files (including my app and wrapper) are intended to exist locally on the user's machine, but the file they select can exist in any directory. So to be clear: Main application (AS3) -> Wrapper (AS2) -> User's file (AS2)
I know how to get the uploaded file's ActionScript version from the Loader's loaderInfo.actionScriptVersion variable, and that's working correctly. My issue is how to pass the file from the AS3 application to the AS2 wrapper so it can load it.
My first thought was to dump the ByteArray from the FileReference's load() function into a SharedObject "cookie". This method seemed pretty bad from a user-experience point of view, but it seemed most likely to work. However, I've been unable to find any method within AS2 to load the ByteArray as a movie (in fact, AS2 doesn't even seem to have a ByteArray class). So the first potential solution to my problem would be if anyone knew of a method for loading a movie from a ByteArray in AS2.
My second thought was to pass the uploaded file's path to my wrapper via the already-setup LocalConnection bridge, and then just have it load the file from that. However, I can't find any way to get the file's path, and my Googling suggests the security model intentionally prevents it. Not to mention, I'm not sure I can load an arbitrary file from the user's machine.
My "hands up in the air; I give up" solution was to just create separate buttons for loading AS3 and AS2 files (leaving it up to the users to guess which it is!) and have the AS2 button actually within the AS2 wrapper. However, it looks like AS2 doesn't have a file browsing uploading API, and the PHP-hybrid solutions I've found aren't an option (because this is meant to be run locally).
So, I would be eternally grateful if anyone could point me in the right direction for solving any of these three roadblocks. Alternative workarounds are of course welcome.
(Edit)
Ok, I found the documentation for AS2's version of the FileReference class. It supports the same file-browsing capability, but does not support directly loading the selected file into the SWF.
However, the security sandbox doesn't seem as strict for local files as I expected, and it looks like I can load any SWF on the user's machine once I have a path to it. So I should be able use JavaScript and an HTML form with a file input to get and pass the file path to my application. It's not ideal having to do all of this from within a web browser, but it should work. If it turns out satisfactorily I'll submit it as an answer.
(Edit 2)
Scratch the HTML-form idea. Looks like the path is hidden from JavaScript for the same reasons Flash hides it. The only option I can think of now is to have the user copy and paste the path to the file...
After reading over your post, you may be able to retry one of your previous attemps with some new information. Actionscript 2 DOES have a method for looking up files from a browser, same as AS3 does. AS2 also has a FileReference class. Check out the documentation here:
http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001040.html
Also, here is a tutorial:
http://markshu.ca/imm/flash/tutorial/fileReference.html
Well, all of my other leads have dried up, so I'm submitting the two answers that will actually work, although neither is ideal:
A) Use Adobe AIR, which will give more access to the filesystem (such as for getting path info) at the cost of requiring the separate AIR runtime to be installed.
B) Have the user enter the path to the file themselves (cumbersome for the user)

Cache Manifest messes up my app when online

Gurus of SO
I am trying to play with CACHE MANIFEST/HTML5. My app is JS heavy and built on jquery/jquerymobile.
This is an excerpt of what my Manifest looks like
CACHE MANIFEST
FALLBACK:
/
NETWORK:
*
CACHE:
/css/style.css
/js/jquery.js
But somehow, the app doesn't load the files the first time itself and the entire app breaks down.
Is my format wrong?
Should I never load JS into the Cache?
How should I treat this differently to always check the network first if anything isn't available and only load stuff available from the Cache?
Thank you.
I tried a simple page with your cache manifest and it worked fine for me, so I'm not really sure what the problem is. But,
Yes, there is something wrong with the format. The entries in the FALLBACK section need to have two parts: a pattern, and a URL. This says "if any page matching the pattern is not available offline, display the URL instead (which will be cached)." The main example of this (as shown here) is "/ /offline.html", which means "for all pages, if we are offline and they are not cached, display /offline.html instead." However, I don't think this is the source of your problem since I tested it with your exact manifest and it still worked.
There is nothing special about JS files. It should be fine to load them into the cache.
I don't understand the third question. There are possibly two goals here: a) how do you check to see if there is a newer version of the file available online first, before going back to the cache, and b) how do you check the network to see if there is a file that is not cached, and if we are offline, fall back to an error page. The answer to (a) is that once you have turned on the cache manifest, things work very differently. It will never check for new versions of the files unless there is a new version of the manifest also. So you must always update the manifest whenever you change any files. The answer to (b) is the FALLBACK section.
See Dive Into HTML5's excellent chapter on this, particularly the section "The fine art of debugging, a.k.a. “Kill me! Kill me now!”" which explains how the manifest updates.
Also I don't think we've gotten to the meat of your question, because it's unclear what you mean by "the app doesn't load the files the first time itself". Which files don't load? Do they load properly after a refresh? Etc.
The only way I got this to work to refresh a cache was to rename the manifest file with a commit number or timestamp, and change the cache declaration to
<html manifest='mymanifest382330.manifest'>
I made this part of my build.

When I zip up my demo FlashDevelop project..why does it break?

I built an AS3 image gallery using FlashDevelop.
Before I zip up the application, I can run the image gallery in my browser by simply opening the index.html for the project. Everything works perfectly.
I then zip up the project as proj-0.1.2.zip using winrar.
I then unzip this newly created zip and try to load the application using the project index.html like above. The gallery doesn't function properly. From seeing what happens, it appears as though the image metadata is not present(but I'm not sure, see below).
There are other applications as well that are broken. Videos don't load. If an application doesn't depend on any external assets then everything looks fine.
Another thing..If I then build the FlashDevelop project and republish the swf..then it works in the index.html like I want. What is going on here?
I want people to be able to fire up my demo apps out of the box by just running the index.html. If that doesn't always work and they have to figure out that they need to rebuild the SWF then that's pretty bad.
I don't think zipping is the problem, I think moving to a different folder is a problem.
I assume you are running this index.html on your local PC, and not on a webserver?
By default, Flash cannot access from a local SWF to load other local files. However, FlashDevelop / Flash CS3 / Flex Builder, in order to get around this restriction, set some flags in the flash player telling him "This SWF is a trusted SWF, allow him to open local files". But it's based on the exact location of the SWF.
There's a setting somewhere in the compiler, that sets a flag in the SWF saying "This SWF can access local data", but there's one downside: It blocks all access to network resources. So it's either/or: access local data, OR access network resources (anything that goes over HTTP, Socket, etc). I'm not sure where this setting is offhand. It may be that the default setting for Flash CS3 is different than the default setting for FlashDevelop.
Anyway, the easy way to avoid all this issue is to not run the file locally. Put it on your webserver before testing.