Search

 


Time travelling into the future at a rate of 1s/s

Adobe Flex EventListener fails on effect sequence

Posted by Paul McConnon Fri, 06 Jul 2007 21:39:00 GMT

I recently came across a gotcha when adding an event listener to a Flex effects sequence whose child effects were duplicated.

I had defined an effects sequence and an effect…

e.g.
var spinSequence:Sequence;
var mover:Move = new Move(target);
mover.yBy = -762;
mover.easingFunction = Linear.easeNone;
mover.duration = 1000;
I then added the same effect to the effects sequence multiple times
spinSequence.addChild(mover);
spinSequence.addChild(mover);
spinSequence.addChild(mover);

I then added an event listener to the sequence to be called when the sequence completed…

spinSequence.addEventListener("effectEnd", setComplete);

The effects sequence worked as I expected, chaining the effect 3 times before completing. Unfortunately I found that event listener would only be fired sporadically. Sometimes it would work for a while and then fail. Sometimes ir would fail straight away. I was pulling my hair out for ages (and I don’t got much of that to pull) before I tried creating duplicate events. For testing I just cut and pasted my code, creating 3 seperate Move effects (mover, mover2 and mover3), a la…

var mover:Move = new Move(target);
mover.yBy = -762;
mover.easingFunction = Linear.easeNone;
mover.duration = 1000;
var mover2:Move = new Move(target);
mover2.yBy = -762;
mover2.easingFunction = Linear.easeNone;
mover2.duration = 1000;
var mover3:Move = new Move(target);
mover3.yBy = -762;
mover3.easingFunction = Linear.easeNone;
mover3.duration = 1000;

and added the (now distinct) events to the sequence…

spinSequence.addChild(mover);
spinSequence.addChild(mover2);
spinSequence.addChild(mover3);

Now when adding the event listener, the event fires all the time. I suspect that the issue is one of Garbage Collection, but I’m new to Flex so I could be well wrong.

Anyways, posted this just in case someone else is slowly going bald with the same problem.

Tags ,  | 20 comments | no trackbacks

Comments

  1. Avatar Greg said 2 months later:
    Thanks for sharing that Paul. I've got a hell of a messy project that might benefit from some variation on your post. Too late for saving any of my hair, but appreciate it none the less tho...
  2. Avatar Greg said 2 months later:
    Thanks for sharing that Paul. I've got a hell of a messy project that might benefit from some variation on your post. Too late for saving any of my hair, but appreciate it none the less tho...
  3. Avatar rssnewsdigest said 9 months later:
    Try rssnewsdigest.com, a new comprehensive news aggregator. With rssnewsdigest, you don ’t really have to go anywhere else. http://rssnewsdigest.com
  4. Avatar torrent search said over 2 years later:
    a friend of mine suggested reading a very useful article about Adobe Flex he downloaded by some site, but I found it too difficult to comprehend. this post seems just exactly for me to learn lots of useful things. thanks for sharing.
  5. Avatar Rackmount LCD said over 2 years later:
    Your blog is intellectual. Thanks for keep informed. I like your blog very much. For more information I will be in touch.
  6. Avatar registry cleaner reviews said over 2 years later:
    I suspect that the issue is one of Garbage Collection, but I’m new to Flex so I could be well wrong.
  7. Avatar TV Links said over 2 years later:
    TV Streaming is far easier for a user to simply log onto a webpage without registering than to have to spend time registering and downloading often large programs.
  8. Avatar Watch Series said over 2 years later:
    Thank you for your great ideas and techniques - your's are better than most of what I've run across so far on the web
  9. Avatar Buy Yagara Online said over 2 years later:
    Buy Yagara online
  10. Avatar sonnerie portable gratuit said over 2 years later:
    This looks absolutely perfect. All these tinny details are made with lot of background knowledge. I like it a lot. Keep on taking action!
  11. Avatar installment loans no credit check said over 2 years later:
    First of all thanks a lot for the interesting and informative article. I have to admit that I always follow your website because it is full of various information about everything. Reading this article about the Adobe flex I have known many new information which I have not known before. Some parts of your post was a little bit difficult for me to understand but when I read everything twice, everything was clear for me. Thanks a lot one more time for the useful information, without you I would never known about such a thing ever.
  12. Avatar extreme makeover said over 2 years later:
    Thank you for your great ideas and techniques - your's are better than most of what I've run across so far on the web extreme makeover: home edition season 7 episode 19
  13. Avatar sibat0705 said over 2 years later:
    Official balenciaga handbags Online Shop - offering you balenciaga inspired fashion and lifestyle for women balenciaga handbags
  14. Avatar toronto home renovations said over 2 years later:
    Great post and very interesting information provide for us. This is the awesome and I like it. It’s really nice.. I totally agree with you!!!! toronto home renovations
  15. Avatar Circular bench saw said over 2 years later:
    Great post, thanks for sharing.
  16. Avatar circular saw bench said over 2 years later:
    Cool!
  17. Avatar table bench saw said over 2 years later:
    I agree with the previous commenter.
  18. Avatar louis vuitton store said over 2 years later:
    This blog is very rich, content, will often come around. correctalittle.com
  19. Avatar Child | Parent Magazine said over 3 years later:
    Get best parenting guidelines for childcare by the help of parent magazine and Parent Child Magazine Contest to keep your baby healthy and fit.
  20. Avatar Form I-765 said over 3 years later:
    Form I-765 Form I-765 Form I-765 Form I-765 Form I-765 Form I-765

Trackbacks

Use the following link to trackback from your own site:
http://www.plopcentral.com/trackbacks?article_id=650

(leave url/email »)

   Preview comment