as i posted this, i then tried another test (Matt your suggestion of 
trying 2-3 frames later) and this time it worked. 
not sure what the correct code is (for continuing code 3 frames 
later) but i used a doLater() and a 'count' variable.



--- In flexcoders@yahoogroups.com, "bhaq1972" <[EMAIL PROTECTED]> wrote:
>
> Doug and Matt (thanks for suggestions).
> Matt, your suggestion worked in my simple test (a doLater() did 
the 
> trick).
> However, when i tried to migrate this into a general utility class 
> it still gives height=0.
> 
> code as follows (important bits)
> 
> class myUtils { //actually a singleton
> 
>  var myMenu:Menu;
>  
>  function createmenu(mypanel, mydp):Void
>  {
>    var myMenu:Menu = Menu.create(mypanel, mydp);
>    myMenu.doLater(this, "positionMenu");
>  }
>  
>  function positionMenu():Void
>  {
>    trace(myMenu.height + "|" + myMenu.width);
>  }
> }
> 
> any ideas thanks.
> bod
> 
> --- In flexcoders@yahoogroups.com, "Matt Chotin" <[EMAIL PROTECTED]> 
> wrote:
> >
> > You may need to wait a few frames before the width and height 
are 
> known,
> > it needs to measure and draw itself.  What happens if you use a 
> button
> > to check the width and height so that you can wait briefly?  If 
> that
> > works just write code to wait 3 or 4 frames and see if you can 
> process
> > everything then.
> > 
> > Matt
> > 
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of bhaq1972
> > Sent: Wednesday, January 18, 2006 7:54 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Flex 1.5 how to get Menu height and width
> > 
> > Hi
> > I'm looking at the flex 1.5 livedocs example of how to create a 
> Menu -
> > http://livedocs.macromedia.com/flex/15/asdocs_en/index.html (at 
> the 
> > bottom).
> > 
> > I cant seem to get the height and width of the Menu after 
creating 
> the 
> > menu. eg
> > 
> > myMenu = Menu.createMenu(panel, myMenuData);
> > 
> > trace(myMenu.height); //always 0
> > trace(myMenu.width); //always 0
> > 
> > How do i get the actual height and weight.
> > 
> > TIA
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: 
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > Yahoo! Groups Links
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to