?
Solved

get the x posion of a panel inside a HDividedBox

Posted on 2011-02-25
4
Medium Priority
?
491 Views
Last Modified: 2012-05-11
Hi i have a HDividedBox containing two panels

panel1 | panel2

what i need to do is find out the x position of panel2 within the panel2 code

i thought this would be as easy as using the this.x but alas this returns as 0

Please HElp very urgent
0
Comment
Question by:cghrmauritius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34985360
Kindly share the mxml file structure.

Warm Regards
Deepanjan Das
0
 

Author Comment

by:cghrmauritius
ID: 34985810
Simplified mxml file structure

note that Panel2 is actually a custom component and its withing the panel2 which i am trying to find its x position within its parent DividedBox

thanks in advance
<mx:HDividedBox width="100%" height="100%">
<mx:Panel width="300" height="100%" id="panel1"/>
<mx:Panel width="100%" height="100%" id="panel2"/>
</mx:HDividedBox>

Open in new window

0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 2000 total points
ID: 34986004
Try This:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
				backgroundColor="gray" height="100%" 
				verticalScrollPolicy="auto" horizontalScrollPolicy="auto"
				
				>

    <mx:Script>
        <![CDATA[
            private function onClick( event:MouseEvent ):void
			{
				var o:* = (event.currentTarget);
				trace( o.parent.x );
			}
              
        ]]>
   </mx:Script>        
	<mx:HDividedBox width="100%" height="100%">
		<mx:Panel width="300" height="100%" id="panel1"/>
		<mx:Panel width="100%" height="100%" id="panel2">
			<mx:Button click="onClick(event)" label="click" />
		</mx:Panel>
			
	</mx:HDividedBox>   
</mx:Application>

Open in new window


Warm Regards
Deepanjan Das
0
 

Author Closing Comment

by:cghrmauritius
ID: 34986147
ok thanks suffering  tiredness from working round the clock, thanks
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question