March 11th, 2008 by Kyle
Tags: , , ,
Posted in: Flash Player

I thought this was a very important notice that I should bring more attention to:

Preparing for the Flash Player 9 April 2008 Security Update

“Adobe is planning to release a security update for Flash Player 9 in April 2008 to strengthen the security of Adobe Flash Player for our customers and end users, and to provide further mitigations for previously disclosed vulnerabilities. The Flash Player security update provides further mitigations for issues listed in the December 2007 Security Bulletin ABSP07-20 for DNS rebinding and cross-domain policy file vulnerabilities, and Security Advisory APSA07-06 for cross-site scripting vulnerabilities in SWFs. Due to the possibility that these security enhancements and changes may impact existing content, Adobe is providing relevant information in advance to allow customers to better prepare for the pending release.

Customers are advised to review the upcoming Flash Player updates to determine if their content will be impacted, and to begin implementing necessary changes immediately to help ensure a seamless transition. This document provides an overview of the upcoming Flash Player changes, links to TechNotes, and relevant documentation to help you better prepare.”

Please read the full document and pay attention! This may affect you.

-Kyle


No Comments »

February 28th, 2008 by Kyle
Tags: , , , , , ,
Posted in: Flex

Flex 3 has been out since Monday of this week and there are a lot of new learning resources available through the adobe website.

This is my favorite starting point:
http://learn.adobe.com/wiki/display/Flex/Getting+Started

Within that page is a “download projects” link that has some great Flex Builder example projects for various things:

http://learn.adobe.com/wiki/display/Flex/Download+Projects

* Building a simple RIA
* Exchanging data with a server
o PHP version
o JSP version
o ColdFusion version
o ASP.NET version
* Working with data
o PHP
o JSP
o ColdFusion
o ASP.NET
* Handling events
* UI layout
* Displaying lists
* Customizing components
* Multi-page apps
* Debugging

Also, slightly buried within the Getting Started guide is a list of compatibility issues:

http://learn.adobe.com/wiki/display/Flex/Backwards+Compatibility+Issues


No Comments »

I just wrote a simple Google gadget that wraps the flash player version checking swf on the Adobe Support site.

I thought it would be a good intro for me on how to create Google gadgets and a useful one at that!


2 Comments »

So it is almost February already! Where did January go? I’ve been a bit slow out of the gate this year as far as keeping up a decent pace in posting helpful samples to my blog. Actually, I have been working on things behind the scenes, a few details of which I will reveal now. I have launched a new blog on a new domain. The content is to be all “work” related, so it will be about Flex/Flash Player/Adobe AIR, LiveCycle Data Services/Blaze DS/ColdFusion and other fun technologies. I’ve also been working on an AIR app which I hope to get out at least in a fairly stable beta form around the same time that Flex3/AIR releases. It will most likely be open source and hosted on Google Code. I will also be compiling a library of useful components, extensions to components and monkey patches to the Flex framework. This new blog and content will all be available on:

http://flexmonkeypatches.com

All old posts on http:blog.739SaintLouis.com should link to or redirect to the same content on my new site. I will leave my old site up for an undetermined length of time with the intent of transforming it content-wise into a more personal blog (time permitting.)

Regards,

-Kyle


No Comments »

I had seen references describing how to do this, but hadn’t seen a complete example, so I whipped this one up for a customer.

Using RemoteClass metadata triggers code gen in in the compilter to ensure that the class is registered with the VM before the application can use it, this includes receiving it from a network request. The only case in which this could be a problem is if it was being used with remoting and there wasn’t a corresponding server class that also implemented the flash.utils.IExternalizable interface.

Externalizable interface doesn’t effect the ability to be serialized in AS3, it just provides customization of what gets serialized. Generally it is only used to serialize private data or hide public data from serialization. Marking the class with [RemoteClass] is what allows the typed serialization of the object (again just mxmlc code gen at the right point using the registerClassAlias() method).

There aren’t any issues, at least none that we have hit, with LSO storage and custom serialization using IExternalizable. As long as the SWF that is retrieving the data from the LSO has the IExternalizable classes linked in and registered (potentially with a “dummy variable”) then I don’t know of any reason why that wouldn’t work.

The real work behind the scenes is done by using flash.net.registerClassAlias() and it is documented (although hard to find) at:
http://livedocs.adobe.com/flex/201/html/lsos_087_3.html

Browse the source of this example.
Download a zipfile containing the source to this sample.

This movie requires Flash Player 9

Read the rest of this post»


No Comments »

Grant Skinner has rehashed some of the content from his site into 2 articles on Adobe’s devnet. I think most of the content is the same, just better organized and presented:

http://www.adobe.com/devnet/flashplayer/articles/resource_management.html
http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html


No Comments »

I have been asked about this from various different angles and responded to it (often with ammo from others) in various different ways. I have decided to compile all info I can as a starting point to address questions hat typically come up from Flex customers regarding Flash Player Memory Management and Flash Player Garbage Collection.

CAVEAT: I am not a Player engineer and haven’t looked at the Flash Player code, but this is my understanding from several discussions with the engineers on the Flash Player and Flex Teams. (Some of this info is taken directly from emails, forum postings and conversations I have had with Alex Harui, Matt Chotin and Gordon Smith.)

Also, Grant Skinner goes into far more detail on his blog about Flash Player Memory management and Garbage Collection.
If you want to know more than the high level that I am going to address here you should check out his blog entries:

http://www.gskinner.com/blog/archives/2006/09/resource_manage.html
http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html
http://www.gskinner.com/blog/archives/2006/09/garbage_collect.html

The underlying Flash player is essentially a garbage collection memory model. That means that if nobody has a reference to an object, it will be collected and thrown out eventually. Thus, you never have to delete anything, just make sure all of your references to it are broken by removing objects from the displaylist, removing event listeners or using weak listeners where appropriate.

The Flash Player runs within the browser’s memory space and Firefox or IE give memory to the player. The browsers are then responsible for the memory and will release it to the heap.

Here is a general description of what is generally going onwith memory management as an app runs:

The Flash Player grabs OS memory in large chunks, divides them up into smaller chunks and allocates those small chunks to the application. As the number of small chunks dwindles, the player runs a GC pass to see
if any of those small chunks can be freed before we go to the OS for another big chunk. If the application is idle and nothing is accessing memory, nothing is going to force a GC pass so nothing will ever get freed.

So lets say the Flash Player allocated 40 megs. If the app happened to get to 33 megs there may be no need for the Player to GC. And it could be that in reality the Player could get away with only 20 megs, but it will take that whole 40 b/c the OS is letting it. Still not technically a memory leak, even if you think the Windows Task Manager should show less.

The MemoryMonitor tries to force a GC pass (see the hack comment in the code). It is unclear as to whether the hack works perfectly.

GC is opportunistic. This means it does not run all of the time. It tends to be triggered by allocating memory instead of freeing it, so watching an idle app will almost never result in GC. Because of the fact that GC is more or less “opportunistic”, there is no current way to manually test for memory leaks. I think there are situations where lots of activity forces several large chunks to be acquired from the OS and then, when most of that stuff is freed, each of the large chunks has a few small chunks still in use and so the OS chunks are not released back to the OS because there isn’t enough activity to cause a GC pass. Therefore, the only way we “prove” there is a memory leak issue is to use MemoryMonitor’s callback to repeat a sequence over and over again.

Now, lets look at an example.

Read the rest of this post»


No Comments »

I have been asked this a few time by customers and figured this was worthy of a quick post:

The release and debug player cannot co-exist on a machine.
(You can’t have release and debug activeX or release and debug plugin installed at the same time, but you can have release activeX and debug plugin)

A player (plugin/activeX control) with the same version#, regardless of debug or release type cannot upgrade an installed player with the same version#. You must first uninstall the player then install the other version of the same player# to switch between release and debug player of the same version#.

The debug player is not available to the general public; it is only available within purchase products (like Flash Authoring, Flex Builder, FDS).

A debug swf will run in either player, but only produce trace and throw RTEs in the debug player.

You can determine what version of the player you are running from within a Flex app using the following code:

<mx:Label text="{Capabilities.playerType} {Capabilities.version} {(Capabilities.isDebugger)? ‘debugger’ : ‘release’}"/>
 

No Comments »

February 5th, 2007 by Kyle
Tags: , , , , , , , ,
Posted in: ActionScript, Flash Player, Flex

I’ve been asked this by at least 4 customers and provided them with simple samples that set the stage.quality = StageQuality.BEST. This provides smoother image scaling, but at potentially some performance cost. You also have to use the loaded image’s content property, casting it to a bitmap in order to scale it. I don’t recall exactly where I found the info on this, but I Googled and didn’t find a good reference for doing this, so I thought I’d post my own solution.

Check out the code snippet:

<mx:application xmlns:mx="http://www.adobe.com/2006/mxml">
    applicationComplete="stage.quality = StageQuality.BEST">

    <mx:script>
        <!–[CDATA[
            private function handleImageComplete(event: Event): void {
                var bitmap: Bitmap = ((event.target as Image).content as Bitmap);
                if (bitmap != null) {
                    bitmap.smoothing = true;
                }
            }
        ]]–>
    </mx:script>

    <mx:hslider id="zoomSlider">
        height="150"
        buttonMode="true" useHandCursor="true"
        minimum="1" maximum="10"
        snapInterval="1" tickInterval="1" value="1"/>

    <mx:image height="600" width="800">
        scaleX="{zoomSlider.value}" scaleY="{zoomSlider.value}"
        source="me.jpg" complete="handleImageComplete(event)" />
</mx:image></mx:hslider></mx:application>


No Comments »