PrimalScript from Sapien Technolgoies is now available as a public beta! Some of you may have already seen Sam and I post about this editor, if you have not here are some details of what features it brings for ActionScript 2.0 (It also supports 30+ other languages and introduces support for Flex, JSFL, and FCSSAS) .
Continue reading
Category Archives: Flash
Lazy deserialization improves WebService performance in Flash MX 2004
In response to a support request for our charting components I was looking into how a v1 component utilizes a v2 data source, such as the results from a WebServiceConnector. In stepping through the code, I noticed something surprising: the XML returned from the web service is deserialized on an as-needed basis instead of all at once. In the XML world this is called “lazy deserialization” and it’s a big feature I’ve never heard anyone mention as related to Flash MX 2004.
Curious? Here’s how it works…
Continue reading
Undocumented Flash Player 7 Features: Recursion limit and script timeout
I couldnÂ’t sleep for some reason Sunday night so I decided to look through the File Format Specifications that Macromedia published recently. To my surprise there are a few things in there that I found interesting.
The cool chapter to check out is the “What’s New in Macromedia Flash (SWF) File Format 7”. In this chapter, there is mention of “ScriptLimits” which is a tag that sets the Maximum recursion depth and the script timeout seconds of a swf. Usually the MaxRecursionDepth is set to 256 as anyone who’s had the player loop a few too many times, and the ScriptTimeoutSeconds is responsible for that dialogue that pops up after 15 seconds.
It turns out that in the new player you have the ability to control those settings, wherein before you had to always make sure your movie behaved within those restrictions. I donÂ’t recommend people modify these settings, but if it is ever needed itÂ’s good to know it is there. Also there is mention of the default value of ScriptTimeoutSettings which apparently varies by platform (between 15 to 20 seconds). IÂ’m not sure if this is for Mac/Windows or actually for low-performance devices like pdaÂ’s but I didnÂ’t know about this variation before.
There are some other interesting things in there. If you have never looked at the file format specs, I definitely recommend it if you canÂ’t sleep and feel like getting deep into the byte code of your precious swfÂ’s.
invalidateStyle needs invalidation itself
I’m working on the next version of our component set and implementing all of it’s styles. I was trying to figure out how components knew to redraw themselves when one of their styles change since they don’t seem to subscribe to any style events.
After digging for a while I found mx.styles.CSSSetStyle and notifyStyleChangeInChildren(). Seems a little odd, it loops through every movie clip in the entire application and calls invalidate style based on some criteria. Regardless of criteria, it recursively loops through every movie clip in the entire application.
This is all based on a single setStyle call. So, I did a little testing. I put a trace statement in notifyStyleChangeInChildren, added a bunch of components to the stage, and a few frames later I made some setStyle calls. With one setStyle call, notifyStyleChangeInChildren was called 316 times and with four calls 1260 times.
That’s a lot of calls, and a few seconds of frozen movie. So seems like we need a new setStyle method that invalidates the call to notifyStyleChangeInChildren, which itself just invalidates styles. Or better yet, how about adding in an event interface so we don’t loop through every movie clip but instead only those that use the style we changed.
Oh, and btw, it only loops through clips from _level0 onward. I guess if you load things into _level1 or higher, they don’t update based on style changes.
::sigh::
Come see Macromedia Flex at MAX
Our employer, B-Line Express, will have a booth at MAX to showcase our B-Line Charting Components. We’ll be demonstrating both the currently available 2.5 set and the in-development 3.0 version. This latter version is a complete re-architecture around the v2 framework and supports both Macromedia Flash MX 2004 and Macromedia Flex. If you’re at MAX, come by our booth to check out how our components can be easily integrated into a Macromedia Flex application with code such as follows.
<bl:LineChart id="chart" x="0" y="0" width="500" height="400" title="SampleLine Chart" pointType="circle" dataProvider="{dataStore.sales}" marginRight="100" xmlns:bl="com.blinex.charts"> <bl:xAxis field="Month"/> <bl:yAxis minValue="0" maxValue="10" majorUnit="1"/> <bl:series title="Tom" field="tomSales"/> <bl:series title="Dick" field="dickSales"/> <bl:series title="Harry" field="harrySales"/> </bl:LineChart>