Scottae
01-12-2006, 08:28 PM
Anybody know if it's possible to get the dimensions of the available area of a section or View of an Accordion component? Here's what I mean.....create new movie, stick Accoridion component in the library, stick this code on the main timeline and test it out:
import mx.core.View;
import mx.containers.Accordion;
// Create an accordion
var my_acc:Accordion = createObject ("Accordion", "my_acc", 1);
my_acc.setSize (400, 300);
// Create the sections for the accordion
var first:View = View (my_acc.createSegment (View, "first", "First"));
var second:View = View (my_acc.createSegment (View, "second", "Second"));
var third:View = View (my_acc.createSegment (View, "third", "Third"));
// Try and see what the width and height are for the first view
checkDimensions ();
// Wait a little bit before checking the width and height
var id:Number = setTimeout (checkDimensions, 1000);
// Function used to check dimesions of the first view
function checkDimensions ()
{
trace ("width : " + first.width);
trace ("height : " + first.height);
trace ("_width : " + first._width);
trace ("_height : " + first._height);
trace ("");
}
I get this in the output window:
width : 100
height : 100
_width : 0
_height : 0
width : 100
height : 100
_width : 0
_height : 0
Obviously not the result I want. How can I get the dimensions of the content area for a View?
import mx.core.View;
import mx.containers.Accordion;
// Create an accordion
var my_acc:Accordion = createObject ("Accordion", "my_acc", 1);
my_acc.setSize (400, 300);
// Create the sections for the accordion
var first:View = View (my_acc.createSegment (View, "first", "First"));
var second:View = View (my_acc.createSegment (View, "second", "Second"));
var third:View = View (my_acc.createSegment (View, "third", "Third"));
// Try and see what the width and height are for the first view
checkDimensions ();
// Wait a little bit before checking the width and height
var id:Number = setTimeout (checkDimensions, 1000);
// Function used to check dimesions of the first view
function checkDimensions ()
{
trace ("width : " + first.width);
trace ("height : " + first.height);
trace ("_width : " + first._width);
trace ("_height : " + first._height);
trace ("");
}
I get this in the output window:
width : 100
height : 100
_width : 0
_height : 0
width : 100
height : 100
_width : 0
_height : 0
Obviously not the result I want. How can I get the dimensions of the content area for a View?