November 9th, 2007

Developer Notes – SWF Caching

I’ve been playing with RSLs last couple of weeks, and during this time I’ve done some testing regarding browser caching of SWFs. Here are some quick notes on what I discovered:

1. When running your Flex app locally – for instance, when debugging with Flex Builder – neither Firefox nor Internet Explorer cache SWFs. It makes sense, but it may trip you up when your trying to debug issues that may be related to caching.

2. On Windows Vista a default install of Internet Explorer 7 runs in Protected Mode. Also, Protected Mode only exists on Vista due to it’s dependency on UAC (User Account Control). Anyway, the reason I mention Protected Mode is because cached SWFs are stored within Content.IE5 subfolders of a special LOW folder in the Temporary Internet Files directory when you’re running in this mode.

3. Turn off Protected Mode and leave the other configurations in Internet Explorer 7 default. Make sure to restart IE. In this configuration, SWFs will be cached, and set to never expire.

4. In a default configuration of Firefox – my version is 2.0.0.9 – SWF are cached and set to expire every 5-7 minutes or so. From what I can tell, there’s no way to change this setting.

If you want to play around and don’t know how to look at the files in your cache, here’s how you can do it:

  • Firefox 2.0.0.9:
    1. Open Firefox
    2. in the address bar type “about:cache” for your URL
    3. From there you can click into either the memory cache or the disk cache
    4. once you’ve clicked into either cache, you can click on the links provided with each individual cache item to view information on the item
  • Windows Vista
    • Internet Explorer 7 (Protected Mode ON)
      1. Tools menu
      2. Internet Options
      3. General Tab
      4. Browsing History section
      5. Settings Button
      6. View Files button.
      7. Note that in Protected Mode, the folder that’s displayed is incorrect. To change this, change the folder buttons in your address bar to a string path, and navigate into the LOW subdirectory. For instance: C:\Users\{username}\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low
    • Internet Explorer 7 (Protected Mode OFF):
      1. Tools menu
      2. Internet Options
      3. General Tab
      4. Browsing History section
      5. Settings Button
      6. View Files button. For instance: C:\Users\{username}\AppData\Local\Microsoft\Windows\Temporary Internet Files\
    • Windows XP
      • Internet Explorer 7 (Protected Mode OFF)…I’m not running XP, but I would assume it’s the same steps in IE7 pointing to a different Temporary Internet Files directory location. Anyway:
        1. Tools menu
        2. Internet Options
        3. General Tab
        4. Browsing History section
        5. Settings Button
        6. View Files button. For the directory location I’m thinking: C:\Documents and Settings\{username}\Local Settings\Application Data\Microsoft\Windows\Temporary Internet Files\

Anyway…don’t know if this will help anyone with their development, but I figured I’d save the info for future reference…also, if you have any corrections on the above or other input regarding caching SWFs in the various browsers, feel free to comment. :)

November 8th, 2007

Flex Framework Quick Hikes: Preloader Complete

I’ve been tweaking a custom preloader for a project I’ve been working on. Today I was asked if there was a way to transparently dispatch custom data on complete. In other words, dispatch an event with custom data when the preloader was done vs. dispatching a standard Event of type Event.COMPLETE . Also, what I mean by transparent, is that I want to handle this through the lifecycle events of mx:Application vs. setting a listener on its preloader.

Although I can *fake* Event.COMPLETE by creating and dispatching a custom event of type ‘complete’, the event handled by listening to mx:Application’s applicationComplete did not contain my data. (I thought maybe this might work due to event cloning and bubbling or something…)

The question is, the above possible? This is where the Flex Framework Quick Hike comes into play. This hike is in no way a verbose explanation of what’s going on, but should give you an idea of the interaction and the course of events as analyzed by a third party developer.

Also, I included the line numbers – I’m compiling against 2.0.1hf3 – so you can more thoroughly peruse the Framework code on your own.

So here we go:

  1. mx.managers.SystemManager.as 1373: initialize runs:
    • mx.managers.SystemManager.as 1394: An instance of Preloader is created and a listener for FlexEvent.PRELOADER_DONE is added
  2. mx.preloaders.Preloader.as 130: initialize runs:
    • mx.preloaders.Preloader.as 176: a displayClassName:Class is instantiated – I’m thinking the displayClassName is a reference to the class definition for a DownloadProgressBar or custom preloader class
    • mx.preloaders.Preloader.as 178: a displayClassCompleteHandler event listener is added to the displayClassName
  3. mx.preloaders.Preloader.as 411: displayClassCompleteHandler is invoked as a handler to displayClassName’s Event.COMPLETE event dispatch
    • mx.preloaders.Preloader.as 414: Preloader FlexEvent.PRELOADER_DONE is dispatched
  4. mx.managers.SystemManager.as 2146: preloader_preloaderDoneHandler is invoked due to the FlexEvent.PRELOADER_DONE being dispatched by the Preloader
  5. mx.managers.SystemManager.as 2178: SystemManager invoke a FlexEvent.APPLICATION_COMPLETE on the app (mx.managers.SystemManager.as 2148: app:IUIComponent = topLevelWindow)
  6. FlexEvent.APPLICATION_COMPLETE can be handled by your application by adding a listener to mx:Application’s applicationComplete event

Granted, to be 100% sure of my answer I would have to point at the source, set some debug breakpoints in the Framework code, and mock up a quick example to test my theory. I would say based on the above, the ability to transparently dispatch custom data on preloader complete is NOT a possibility…

Have a good hike!

November 7th, 2007

RealEyes Media Labs – Use our elbow grease too…

If you have been in the development or IT industry for any amount of time, you know by now that this is a community where people share and learn from one another…in a flowery view of the world, we each expend out elbow grease and with the right communication in the community the fruits of our labor are available for everyone else to use.

Recently, I had to come up with a technical brief for a client on building custom components that extend the UIComponent and Container classes. While doing this I got to piggy-back on the elbow grease provided by the likes of Michael Labriola, Josh Tynjala, Peter Ent, Chafic Kazoun, and Joey Lott…all of them awesome developers in the community I might add.

Anyway, the powers that be decided that this brief was approved to be made public. So…if you want the 13 page summary on Advanced Component Developement that I had to write, here it is:

http://labs.realeyesmedia.com/labs/downloads/techBriefs/AdvancedCustomComponents_20071102.pdf

Also, if you notice the URL, we have a site we launched recently to start sharing our elbow grease, there’s some good stuff up there that the team and I have been working on. Here’s the link:

http://labs.realeyesmedia.com

Have a good one!

Powered by ScribeFire.

Upcoming Talks





A Book I Helped Write



Community


Ignite Denver Committee

Categories

Credits