Virtual Thoughts from eRoom-D

Thoughts on web development, Flash, Flex, and game design.

Flash animations in Flex ignoring their stop() actions?

November6

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.

posted under Flex | No Comments »

Getting Flex and Flash to play nice to each other, when they are not on the same server.

August25

Ok, so recently I needed to get a Flash swf into a Flex project and have the two talk to each other. Ok, fairly normal, I did it for a page navigation scroll bar that was AS2 and got it to talk with our Flex project and it works great. Problem though, the Flash swf I need to bring in will exist on another server, and the scroll bar I had worked on, we embedded into the project.

I spent days working on this. Why?

Well, two things:

  1. We get these files from a design firm and I wanted to not change their code that we gave them earlier.
  2. Cross domain issues.

I tried everything I could think of to bust this open, searched around, and came up with the solution. I had to change the code that the design firm used, moving them from AS2 to AS3.

Sean the Flex Guy has an excellent and simple tutorial for doing half of what I needed. It loads in a Flash swf animation, and then Flex talks to it to move the animation forward frame by frame. So that was covered, at least once I made the decision to move to AS3.

The other half, Flash talking with Flex wasn’t covered, but I found a solution in the Adobe Docs. As long as both the Flex and Flash swfs have their Security.allowDomain set properly, then the two can communicate back and forth (this needs to be set for the Flex to Flash work too). What I found out, was that events, such as Mouse events, will bubble if this is set properly. So all I needed to do was to listen for the MouseEvent that was fired when the buttons in the Flash swf were clicked. The rest was easy.

I imagine that if there is something else that happens in the Flash swf, you can create a custom event for it, and listen for that in the Flex swf. Since there are more things in Flash and Flex than are controlled buy your MouseEvents Horatio.

Powered by ScribeFire.

posted under Flex | 3 Comments »

The fate of my Flex accessibility project.

August25

Ok, so some of you might be wondering what happened to the accessibility project that I was going to be working on several months back. Well…

It turns out that the major stumbling block here was the wmode tag that was being used. It needed to be set to wmode=opaque, and it was set to wmode=transparent. Why? Well, wmode transparent as most of you know, allows for Javascript dropdowns to flow over the Flash Player, which we have on many of our client sites. Unfortunately, how it does this is it makes the Flash Player effectively transparent (go figure) to the web browser’s DOM. So the web browser doesn’t take it into account when drawing things on screen. This has the added effect of making the screen readers that attempt to read the contents of the Flash Player either not see it at all, or act erratically when they do start to read it. Nice eh?

So, setting wmode=opaque, the five second change, solved most of the problems with our accessibility, so there was no need for me to do the research and my project on it was cancelled. I do still think that there was a lot to learn for everyone on accessibility, and that the sources out there do cover it, but not all in one place. We’re under tight deadlines though, so any saved time is taken by other things. Considering it meant that I didn’t have to work a weekend or too late, I was totally cool with that.

Powered by ScribeFire.

posted under Flex | No Comments »

Accessibility in the Flash Player…

May14

I thought that I posted this earlier, but when I went back to reference it, it looks like it didn’t post.

My research into accessibility for Flex custom components continues. This time I have something from Zeus Labs. It documents Josh Tynjala’s same efforts as mine in looking into accessibility. He’s discovered some limitations of the flash player, the article is dated May 5, 2008, so it’s timely and focuses on the current Flash Player 9.

Here is a summary of the article, followed by a link to it:

  • Flash Player isn’t accessible on a Mac. (Probably since it uses the Windows accessibility code for Windows, and it looks like it does not include the Mac version of the same.)
  • AccessibilityProperties class doesn’t support roles. Everything is viewed as an image by a screen reader in Flash, not buttons or lists, or any other role.
  • AccessibilityProperties doesn’t expose the display list hierarchy. Things like TabBar’s don’t display as a tree of objects in an assistive application, but as a list of objects. Whereas a Windows application shows a tab list as a tree of objects.
  • Some accessibility APIs in Flash Player are undocumented. Go to the article for the specifics.

Zeus Labs - Adobe needs to improve accessibility in Flash Player (http://www.zeuslabs.us/2008/05/05/flash-player-accessibility-feature-requests/)

What it comes down to is this: While Adobe has definitely improved the Flash Player accessibility, it still isn’t up to the standards of something like an HTML page.

My search continues.

posted under Flex | No Comments »
« Older Entries