2

In our application (a game), in some cases it can't run fast enough. Obviously we'd like to speed it up, but in the mean-time when this happens it causes many problems (or if it's not causing them, the two are related). The one which is least related to our own functionality is that the built in Alert.show() method stops working. Typically the full-screen transparent box appears but not the actual popup. I believe this is down to Flex giving all available cycles to other tasks... but it's proving difficult to investigate analytically so I am happy to hear another explanation.

To clarify, core parts of Flex are simply not working in this situation. I've stepped through the code for instance where a new element is added to the screen, everything happens and the addChild() method is called on the main display canvas... but then the element does not appear. If we then disable our update loop, the element suddenly appears.

So whether Flex is supposed to run the exact same code or not, somehow it IS blocking is some strange way. As I said, even the Flex Alert.show() method doesn't work.

3 Answers 3

4

All Flash content is executed frame-by-frame - Flash executes one frame's worth of code, then updates the screen, and then waits until the next frame update.

When Flash can't keep up with the specified framerate, all that happens is that instead of waiting between frame updates, Flash does them as fast as it can with no waiting in between. So the only visible difference is that frame updates occur less frequently. There are never cases where code is skipped, events are dropped, or screen redraws are skipped for performance reasons (unless you've found new bugs).

So the most likely culprit is that either you have a problem with code that's very time-dependent (such as code that expects two timers to trigger on the same frame), or some other problem that's being misdiagnosed. (For example, maybe there's a bug causing a slowdown, rather than a slowdown causing your bug.)

0

I'm not too sure if Flex has some additional performance handling of it's own. But for pure actionscript the only thing that would happen is the framerate would slow to a crawl, everything will happen normally just slower. If you stack very large amounts of transparent or masked objects you might get some weird behavior, but that should be more noticable.

And I guess telling you that making a game in Flex isn't that much of a good idea (just because of the performance overhead the framework has) is a bit late ;)

2
  • Flex is a fine choice. Way better than trying to write a piece of real software in CS3... I don't know there is much overhead if you don't use Flex-specific functionality anyway; it's the same render hierarchy as in Flash. Sep 24, 2008 at 11:57
  • With Flex he probably just means the Flex compiler, not Flex Builder with mxml etc..
    – Antti
    Sep 25, 2008 at 1:32
0

I like to make games in FLEX 3 (actionscript3), its actually pretty handy solution when compared to Flash CS3: good debugging environment without hassle. Of course it depends on the game style which one is better, if you need lot of graphics you may like Flash more, but Flex allows you to use external images, components, etc. Notice I am not talking about Flex XML project here.

Answer to your performance issue: You can use e.g. old MacOSX machine to see what happens in a very slow machine, a few solutions are: - move objects more than x++ y++ pixels when machine is old - reduce objects

you can detect with a timer how slow machine is..

2
  • I think it's natural to assume that a "flex game" would make use of the flex framework. Coding a pure as3 game in flex builder, does not make it a flex game. The IDE used here is really of less importance.
    – grapefrukt
    Sep 24, 2008 at 13:36
  • I've found when talking about Flex development, nothing can be assumed. 'Flash' covers everything from graphical design to hard-core programming and Flex is often assumed to mean "business charting app". Sep 24, 2008 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.