Well I came across FlexPMD a couple of weeks ago and have found it a useful tool to get some useful tips and highlight things I may have glossed over. An amusing one is the info rule about the copyright header is missing. I will have to make sure I add one in for my world domination of example code. Though that said you can add your own rules in or modify the existing set to create your own custom set of rules. So if you really want to be strict about every line ending with a semi-colon you can write your own class to enforce this rule.
All of this being said I think this is a great tool for Flex/Actionscript developers to review there code. There will always be exceptions to the rules but at least you know you're breaking best practice.
Friday, December 4, 2009
Friday, November 20, 2009
Yeah I'm offically now a User Group Co-Manager
Well I've been active in the Flash Platform/Flex User Group in New Zealand since its inception and been working Kai Koenig and Campbell Anderson to manage the user group. But now I'm officially a Co-Manager of Wellington group :-) This is really cool! I'm looking forward to helping out with community to increase awareness and spread the goodness of Flash :-) Also Tanya Grey is helping out Campbell in Auckland.
Tuesday, November 3, 2009
Earlest time to call a RemoteObject?
I was doing some investigation on how best to retain your session. A lot of Flex applications don't utilize session management especially in the case when the app is restarted by a refresh or a new window. Which then the users are faced by a annoying login window even though the server has retain the session information which negates this need to re-login. But before I really go into that I got sided tracked looking into when is it best or the earliest time you can send off a request to get session information. This is an interesting question with an obvious answer as well. But I wanted to really understand why.
To do the call I'm using RemoteObjects with ColdFusion as the destination. The ColdFusion CFC is fairly basic just returning an array with the JSessionID. All of this will complete quickly to negate any long server processes. Ideally in a production environment I would use a session structure to return to speed things up.
So I wrote some basic ActionScript code to connect and call the CFC. I first tried calling it from preinitialize call. The call worked but it took ~100ms to complete which was troubling which it was just calling a server on my machine. I then did a quick speed test of calling the RemoteObject and was able to call it and get a responds in < 1ms so something else was at play here. I then thought about maybe I should push the call further up the process since preinitilization was happening at ~200ms since application start but I wanted it to start earlier.
Preloader here I come! The preloader was being called at ~100ms and I was really happy but then I hit a road block...
[FaultEvent fault=[RPC Fault faultString="[MessagingError]" faultCode="InvokeFailed" faultDetail="null"] messageId="33578681-51C7-A64A-7C04-B829D52F7A4C" type="fault" bubbles=false cancelable=true eventPhase=2]
This is a puzzling error message since it doesn't give me any reasons why the InvokedFailed? If I called the call the RemoteObject later in the Flex life cycle it worked so seemed strange that it would fail at this point. So bring on Flex Debugger! I got it down to one call which was causing an exception and it was the mx.messaging.config.SeriviceConfig.xml getter. It was being called before it had been set with the complied flex-services.xml which seems strange that it didn't have this embed. Then I started to look into when it got set so and found that it hadn't been called by SystemManager to initialize this value. So even though the complier embeds the value of the flex-services.xml it needs to be set at initialization by the SystemManager.
So what does this boil down to? You can't call RemoteObjects prior to the start of Application preinitialization process since the SystemManager has not completed its own initialization process. Remember that the Application is a child of the SystemManager so following the Flex startup rules you shouldn't do anything with it until initialization of the SystemManager is complete. So using the Application preinitialization/preinitialize event is the best/earliest time to do a call to the server to get data using RemoteObjects.
Oh and the other point about the call taking so long ~100 ms... well I put that down to the additional things that occur at start up. A lot happens when a component/Application is created ;-)
To do the call I'm using RemoteObjects with ColdFusion as the destination. The ColdFusion CFC is fairly basic just returning an array with the JSessionID. All of this will complete quickly to negate any long server processes. Ideally in a production environment I would use a session structure to return to speed things up.
So I wrote some basic ActionScript code to connect and call the CFC. I first tried calling it from preinitialize call. The call worked but it took ~100ms to complete which was troubling which it was just calling a server on my machine. I then did a quick speed test of calling the RemoteObject and was able to call it and get a responds in < 1ms so something else was at play here. I then thought about maybe I should push the call further up the process since preinitilization was happening at ~200ms since application start but I wanted it to start earlier.
Preloader here I come! The preloader was being called at ~100ms and I was really happy but then I hit a road block...
[FaultEvent fault=[RPC Fault faultString="[MessagingError]" faultCode="InvokeFailed" faultDetail="null"] messageId="33578681-51C7-A64A-7C04-B829D52F7A4C" type="fault" bubbles=false cancelable=true eventPhase=2]
This is a puzzling error message since it doesn't give me any reasons why the InvokedFailed? If I called the call the RemoteObject later in the Flex life cycle it worked so seemed strange that it would fail at this point. So bring on Flex Debugger! I got it down to one call which was causing an exception and it was the mx.messaging.config.SeriviceConfig.xml getter. It was being called before it had been set with the complied flex-services.xml which seems strange that it didn't have this embed. Then I started to look into when it got set so and found that it hadn't been called by SystemManager to initialize this value. So even though the complier embeds the value of the flex-services.xml it needs to be set at initialization by the SystemManager.
So what does this boil down to? You can't call RemoteObjects prior to the start of Application preinitialization process since the SystemManager has not completed its own initialization process. Remember that the Application is a child of the SystemManager so following the Flex startup rules you shouldn't do anything with it until initialization of the SystemManager is complete. So using the Application preinitialization/preinitialize event is the best/earliest time to do a call to the server to get data using RemoteObjects.
Oh and the other point about the call taking so long ~100 ms... well I put that down to the additional things that occur at start up. A lot happens when a component/Application is created ;-)
Wednesday, August 19, 2009
Dusting off the cob webs from my blog
Well for the last six months I've been really busy working on a Flex app which really took over my life. Not something I want to do again any time soon. Though the project was really cool, you got to have some work life balance... OK enough about me and more about tech stuff :-)
I'm presenting Back to the Files (Flash & Files) at the Flash Platform Code Camp next month. Which will be a nice overview of what you can do with files now. There is so much you can do now with them :-) Should be a good event with great presenters from throughout New Zealand and even one from Australia. Unfortunately the even has sold out so if you have missed out you can put your name done on the waiting list.
I have a couple of half posts which I need to complete and hopefully you will see them over the next month or so.
Oh and before I go I'm off MAX 09 in LA. Looking forward to the event and catching up with peeps.
I'm presenting Back to the Files (Flash & Files) at the Flash Platform Code Camp next month. Which will be a nice overview of what you can do with files now. There is so much you can do now with them :-) Should be a good event with great presenters from throughout New Zealand and even one from Australia. Unfortunately the even has sold out so if you have missed out you can put your name done on the waiting list.
I have a couple of half posts which I need to complete and hopefully you will see them over the next month or so.
Oh and before I go I'm off MAX 09 in LA. Looking forward to the event and catching up with peeps.
Saturday, April 4, 2009
FLVPlayback 2.5 make video easy with Flex 3
OK so your developing an application and you need a video component for Flex? Well do not go past GO go straight FLVPlayback 2.5. Back in late 2007 I was evaluating Flex with FMS 2 using Flex's video component. I must admit the Flex 2/3 video component is pretty average compared to standard of the other components in the Flex component framework. Simple video functionality was missing in the standard component and to do anything average just required too much effort. It made more sense to use Flash's video component to create a quick video player.
I'm not much of a designer but watching a design college skin FLVPlayback just look so effortless. To say I'm impressed with what FLVPlayback can do is an understatement. I know there have been a few blogs of using FLVPlayback so I'm not going to show an example (See Flex Examples). Also there is plenty of documentation with component itself. One little cool thing that I wanted to point out is to resize the component to the video's correct/preferred size.
In the below example you can see how you can resize your component to play the video in it's preferred size. Note this excerpt highlights that you resize your component after the video is loaded.
private var vid:FLVPlayback = new FLVPlayback();
private function onCreationComplete():void
{
...
vid.addEventListener( fl.video.VideoEvent.READY , readyToPlay);
...
}
private function readyToPlay(e:fl.video.VideoEvent):void {
...
this.width = vid.preferredWidth;
this.height = vid.preferredHeight; // Add the skin's control bar height
...
}
If more detail is required I will added it but this should be enough for the concept.
I'm not much of a designer but watching a design college skin FLVPlayback just look so effortless. To say I'm impressed with what FLVPlayback can do is an understatement. I know there have been a few blogs of using FLVPlayback so I'm not going to show an example (See Flex Examples). Also there is plenty of documentation with component itself. One little cool thing that I wanted to point out is to resize the component to the video's correct/preferred size.
In the below example you can see how you can resize your component to play the video in it's preferred size. Note this excerpt highlights that you resize your component after the video is loaded.
private var vid:FLVPlayback = new FLVPlayback();
private function onCreationComplete():void
{
...
vid.addEventListener( fl.video.VideoEvent.READY , readyToPlay);
...
}
private function readyToPlay(e:fl.video.VideoEvent):void {
...
this.width = vid.preferredWidth;
this.height = vid.preferredHeight; // Add the skin's control bar height
...
}
If more detail is required I will added it but this should be enough for the concept.
Sunday, February 8, 2009
Yip I'm off to Webstock
Well I was thinking this year it was about time I attended a local web conference. I've been to webDU and MAX but never the local one... and it doesn't get much more local than being in your home town. The conference has a range of presenters (local and international) coming from various backgrounds. It will be really interesting to hear what some of these people have to say. Sometimes you can get a bit close minded about things (methodologies, technologies, & products) and this type of conference sheds light on what other people are doing. There is so much happening in the Adobe space one could happily ignore the others.
For more information about webstock 2009.
Oh I see there is a card trading game ...I wonder if Agent K is on the case.
Update: I'm just attending the conference (February 19-20) and not any of workshops.
For more information about webstock 2009.
Oh I see there is a card trading game ...I wonder if Agent K is on the case.
Update: I'm just attending the conference (February 19-20) and not any of workshops.
Sunday, February 1, 2009
Flex Bulider 3.0.2 update does not update AIR projects 1.0=>1.5
Well I updated my Flex Builder plugin from 3.0.1 to 3.0.2 looking to get all the goodness of AIR 1.5 and Flash Player 10. You might be thinking I'm a bit late on the scene with the update being out for about 3 months now but there appears to be a bug with the updater in Eclipse (See Matt Chotin's comment at 30 Jan). Anyhow I installed the update to find my AIR projects not doing anything when I run or debug them. Almost like they were crashing straight off the bat. I created a new AIR project to see if the updater had screwed my system but no the new AIR project worked fine. I then added the 3.0.1 SDK back in since 3.0.2 was the new default and set the project to use it I had no problems. This didn't sit right with me that my AIR projects couldn't use the updated SDK and AIR runtime. I had a look around and noticed the the XML config file for the AIR application was 1.0 I changed it to 1.5 and set the SDK to 3.0.2. The project ran and debugged fine now...
So what does this mean? If you change your SDK the Flex plugin does not update your AIR app config file to the correct version of AIR. Must admit I would expect if you complied an app with a previous version of the 3.0.* SDK that it would still run in the AIR 1.5 runtime. I think there is a little more to this story but I'll leave it here for the moment.
So it appears that changing your SDK version does not update your AIR config file so how to fix?
Change the second line in your myapp-app.xml file from:
<application xmlns="http://ns.adobe.com/air/application/1.0">
To:
<application xmlns="http://ns.adobe.com/air/application/1.5">
So what does this mean? If you change your SDK the Flex plugin does not update your AIR app config file to the correct version of AIR. Must admit I would expect if you complied an app with a previous version of the 3.0.* SDK that it would still run in the AIR 1.5 runtime. I think there is a little more to this story but I'll leave it here for the moment.
So it appears that changing your SDK version does not update your AIR config file so how to fix?
Change the second line in your myapp-app.xml file from:
<application xmlns="http://ns.adobe.com/air/application/1.0">
To:
<application xmlns="http://ns.adobe.com/air/application/1.5">
Subscribe to:
Posts (Atom)
