dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: rawChildren ruins layout in Flex 3

  1. #1
    Member
    Join Date
    Jun 2003
    Posts
    60

    rawChildren ruins layout in Flex 3

    Hey all!

    I've been playing around with Flex lately, and having come from a pure AS3 background, I couldn't help but create some simple effects in there for fun. That's when I hit a snag. Now, with Flex, I'd have to use the UIComponents' rawChildren object in order to add widgets of DisplayObject types... fair enough. Problem is when I do that, the components stop obeying layout rules, transitions stop working, etc.

    The best way to really demonstrate this problem is to see the project itself. Here's a link to the project source:

    http://www.thurinusworks.com/public/problem_src.zip

    In there I created a Panel component that has view states and transitions, and an Application that holds that Panel and houses a bit of actionscript to create a sparkly mouse toy effect. If you commented out all the script for the mouse toy, you'll see that the Panel centers on the Application as you resize the window, and clicking the 'Register' link would display a nice elastic transition effect between view states. When the mouse toy is active, the Panel position stops working correctly, and clicking on the 'Register' link would simply display the view state with no transition. It happens intermittently, but seems to guarantee happening after the first SWF launch, so if you don't see it happening, relaunch the SWF and it should screw up.

    I don't know what's causing it to break like this. It's either my error or a serious bug in Flex, and I dearly hope it's the former... If it is, what must I do to fix it? If it isn't, is there a work-around?

    Thanks for *any* help you can provide!

    Best regards,
    Jay

  2. #2
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    Hi - You are targeting the wrong parent for the removal of the Sparkle. Remember, a Container keeps skins, and it's psudo intrinsic children on the rawChildren object. You are accessing parent instead of parent.rawChildren to remove the sparkle. This resulted in the sparkles never being removed and somehow that monkey'd it all up.

    so the solution is easy:
    code:
    ...if(alpha <= 0){
    removeEventListener(Event.ENTER_FRAME,enterFrame);
    (parent as Application).rawChildren.removeChild(this);
    }


    Your transitions should work now.
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center