Oddity with SharedObject & NetStatusEvent in Flex2?When my Flex application starts I want to set a SharedObject on the users machine.
If the user has their Flash players "local storage" settings at zero, the following popup will appear when you try to flush (save) the shared Object:

At this point, the process is flagged as PENDING. You can add a listener to listen for the NetStatusEvent.NET_STATUS event, which will be dispatched when the user makes their decision.
When this event is fired, your handler method can examine the event object and see whether the user allowed or declined your request for storage.
However, this part didn't work for me in Flex:
I used some *existing* code from an AS3 project, but found that it didn't work in Flex - the event handler never got called. I'm using Cairngorm 2.1, and thought it may possibly have something to do with a timing issue caused by the framework, so I made a new test Flex project, and found it still didn't work.
When looking to see what was different about the AS3 code, the only thing I could see was that my AS3 file extended Sprite and was on the display list, and when I made the same changes to my Flex project, the eventHandler started to get called.
I can't see that this should be require in any way, and while it is a fix, I'm keen to find out what is causing the real problem.
For now though, I simply dispach a Cairgorm event, and call an instance of a Command class which extends Sprite. Although this class doesn't contain any visual elements, I wrap it in a UIComponent and add it to Application.application. SOmething that happens here rids me of the problem.
//In main.mxml creationComplete:
CairngormEventDispatcher.getInstance().dispatchEvent
(new CairngormEvent(GigController.SHARED_OBJECT_INITIALISE));
//in GigController:
addCommand(SHARED_OBJECT_INITIALISE, SharedObjectCommand);
//In SharedObjectCommand (which extends Sprite):
public function execute(event:CairngormEvent):void{
var ui:UIComponent = new UIComponent();
ui.addChild(this);
Application.application.addChild(ui);
//etc
}
If you have any idea what may be causing this, I'd like to hear from you (neil at nwebb dot codot uk)
Thursday, February 22, 2007
I've had a tutorial (
Unit testing & Test Driven Development for Flex and ActionScript 3) posted on the Adobe devnet site.
Scary pic eh!

Flex item renderer with multiline text I've just had "fun" trying to get some multiline text to display properly next to a picture (within in itemRenderer) in Flex2.
I have a user-image which is 100*100, and some text fields which sit in a VBox next to it. The last line of text you can see in the pic (the "description") is a Text component. I wanted it to hold multiline text.
Originally I was doing this:
<mx:text width="100%" height="100%" text=""></mx:text>
However, my text didn't appear to wrap, yet, when I didn't specify the height at all, it did wrap.
I guess that by specifying height="100%" I was not instructing the component to "expand as much as it needed", but rather instructing Flex to "use 100% of the AVAILABLE space". The available space is less than is needed to display the text.
By
not specifying the height, Flex can then work out how high the component needs to be.
Wednesday, December 20, 2006
Check out
http://www.fauxto.com/ - a Flex based Photoshop type app.
Stop Santa's runway from melting!!!Here's a sweet little Flash website with a great aim:
www.green-santa.com
Wednesday, November 29, 2006
I'm back doing a bit of Flash 8 work, and I stumbled across this removeMovieClip()
issue.
Friday, September 29, 2006
Flex Team announce new components
Tuesday, September 26, 2006
I just discovered Andrew Trice's blog. There are some great posts, including these ones regarding Flex framerate and performance
here and
here(those on low-spec machines be aware - processor intensive code)
Saturday, September 16, 2006
Screenshots of
Apollo - looks great!
Flex supports
ZIP files!
Monday, September 11, 2006