A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Setting module x and y coordinates

  1. #1
    Member
    Join Date
    Jul 2004
    Posts
    86

    Setting module x and y coordinates

    Hello,
    I'm pretty baffled by the lack of information I've found about this and even more baffled that it doesn't look like there's support for this functionality.

    I'm building a custom module loader and I want to send x, y, width, height coordinates for each module I'm loading so I can dynamically place modules where I want them.

    I have my moduleReadyHandler as such but when I set the x, y coords the modules placement is unaffected

    Code:
    private function moduleReadyHandler(event:ModuleEvent):void
    {
    	child = module.factory.create() as DisplayObject;
    	dispatchEvent(event);
    
    	if(child)
    	{
    		child.x = 100;
    		child.y = 100;
    		addChild(child);
    	}
    }
    Any ideas?

    Thanks,
    Eric
    Last edited by clem_c_rock; 03-12-2010 at 03:18 PM.

  2. #2
    Senior Member Gohloum's Avatar
    Join Date
    Aug 2002
    Location
    Florida
    Posts
    185
    Can you post a little more of your code? The event coming in should have a targert property of the module that is ready. So you should be able to cast that to a display object and set the values:

    Code:
    var do:DisplayObject = DisplayObject(event.target);
    
    do.x = ...
    do.y = ...
    do.with = ...
    do.height = ...
    The Early Bird may get the worm, but the second mouse to the trap gets the cheese...

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