Like my friend Chris Miller, I’m working, no really, I’m working.

I’ve never been exceptionally good at keeping up with the blog here, even though this year started out fairly well. So in order to keep my momentum going, you know an object in motion tends to stay in motion, I am going to be writing these smaller updates in addition to when I get out my long tutorials and other long form posts.

I’m still working at Digital Primates and loving what I do there. I haven’t had much time while on the job to study up for the Flex Developer’s Certification, so I do that as much as I can from home. I need to take a practice test or two to see where I would score if I took the actual test, and where I need to focus my studies to make sure I pass.

Over the last several months I have worked more with the Flex Framework than I have ever before. I am so used to doing things in pure AS2 an AS3, that I had to retrain myself to look for things in the framework that were already waiting for me to just use them. Some of the people at DP also have been a great help in this. I’d thank them all here, but I’d really be thanking everyone at the company, so thanks guys.

Moving on into the late summer, I am still working on my augmented reality project. My friend and now co-worker (he’s an intern at Digital Primates), Joe, is helping me work through the FLARToolkit. Making things make sense, and finding out where we can speed things up. Optimization was the main topic last week. This week it was me solo, but I was able to get DAZ3D models into our app. Definitely need more optimizing there (15 Meg for a model! jeesh!).

Oh, and I am also now a contributor to the FLARToolkit’s repo. Haven’t submitted anything yet, but I should before the next post. So with Podiobooks.com, this is the second open source project that I am currently active in.

I may get out another post before Gen Con, so stay tuned.

Flash animations in Flex ignoring their stop() actions?

Remember that issue I had with getting Flash and Flex to play nice and give me events from Flash swfs loaded into a Flex application? Well, it’s the same project, same files, and with a new wrinkle.

So we have the near final files from the client’s agency, and they look good, and perform all the interactions that are needed for the launch in a few weeks. Great! Only one problem. The animations never stop, flash on and off, and do all sorts of other things that are strange.

All of it though, is explained by there being no stop() actions in the Flash swf. To remind you, our gentle reader, both Flash and Flex are published in AS3 for Flash Player 9. I had the foresight to request the original FLA files, so even though I don’t have the fonts available, I can still look at the code, and tweak it to see if any changes I suggest to the agency will actually work. The stop() actions are there! What the frell?

So I do some searching, and searching, and searching. Nothing. I did find out that the default frame rate for Flex movies is 24 fps. So taking that, I thought that the frame rates might not be syncing, since the Flash swfs are set at 30 fps. So I change the setting in the Flash swfs down to 24 fps. Nothing, same errors with things spinning, and button states flashing.

Then I noticed that when I rolled over the buttons, that they stopped flashing, even when I was no longer interacting with them. It was like they caught the stop() that was on their timeline. So after a bit of tinkering I found out this. In our Flex application, when these swfs were loaded, if the loaded swfs had Tweens that tweened an animated movieClip, the animation would ignore the stop() actions in it’s clip.

To solve this, I found out that stop() actions needed to be added to every keyframe that the animation had, and it needed to target the movie that was animating. So if a sign was twirling around, it was, I had to add sign.stop(); to every keyframe where I wanted the sign to not move. I added this on the timeline that had the fade in tween of the sign movieClip.

I still don’t know why this happens, but adding the stop() actions that directly target the movie clip that needs to not move fixes it. If anyone has more insight into this, please let me know. I’m stumped as to why it is happening, and why this workaround is needed.

NOTE: I created a test Flex application, with nothing but a swfLoader to see if I could give that to the agency for testing purposes. In that, the animation behaved 100% correctly. So it’s not all Flex applications, just the one I am working on.